You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Process.Handle does not work on Linux like it does on Windows #28773
When targeting to netcoreapp2.0, below code works fine on windows but not linux, WaitHandle.WaitAll returns immediately on linux instead of waiting for process to actually exit. Is this bug or by design?
static void Main(string[] args)
{
Process p;
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
p = Process.Start("timeout", "10");
}
else
{
p = Process.Start("sleep", "10s");
}
var waitHandle = new ManualResetEvent(false);
waitHandle.SetSafeWaitHandle(new SafeWaitHandle(p.Handle, false));
WaitHandle.WaitAll(new[] { waitHandle });
if (!p.HasExited)
{
throw new Exception("Process wait handle is not working properly");
}
else
{
Console.WriteLine("success");
}
}
changed the title [-]SafeWaitHandle does not work properly on linux[/-][+]Process.Handle does not work on Linux like it does on Windows[/+]on Feb 26, 2019
Activity
sunnycase commentedon Feb 25, 2019
Try
Process.WaitForExit().hanabi1224 commentedon Feb 25, 2019
@sunnycase That one works but it's not what I need :(
joshfree commentedon Feb 26, 2019
@jeffschwMSFT
[-]SafeWaitHandle does not work properly on linux[/-][+]Process.Handle does not work on Linux like it does on Windows[/+]