[Mono-bugs] [Bug 699451] New: [System.Diagnostics.Process] Ctrl+C in parent process kills child process

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Jun 11 17:10:36 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=699451

https://bugzilla.novell.com/show_bug.cgi?id=699451#c0


           Summary: [System.Diagnostics.Process] Ctrl+C in parent process
                    kills child process
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: xtzgzorex at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101
Firefox/4.0.1

When ProcessStartInfo.RedirectStandardOutput is true, Ctrl+C in the host
process will kill the child process, even if the host process cancels it via
Console.CancelKeyPress.

Related code:

using System;
using System.Diagnostics;

internal static class Program
{
    private static void Main()
    {
        Console.CancelKeyPress += (sender, e) => {
            e.Cancel = true;
        };

        var proc = new Process
        {
            proc.StartInfo = new ProcessStartInfo("/usr/local/bin/csharp")
            {
                UseShellExecute = false,
                CreateNoWindow = true,
                RedirectStandardOutput = true
            }
        };

        proc.Start();
        proc.WaitForExit();
    }
}


Reproducible: Always

Steps to Reproduce:
1. Compile and run the code.
2. Hit Ctrl+C.
Actual Results:  
The child process (csharp) will exit.

Expected Results:  
The child process should not exit.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list