Uh oh!
There was an error while loading. Please reload this page.
Implement Process.Run, RunAsync, RunAndCaptureText, RunAndCaptureTextAsync APIs - #127210
Conversation
- Add WaitForExit, TryWaitForExit, WaitForExitOrKillOnTimeout, WaitForExitAsync, WaitForExitOrKillOnCancellationAsync to SafeProcessHandle - Windows: uses ProcessWaitHandle + GetExitCodeProcess - Unix: integrates with ProcessWaitState for reaping coordination - Native: WaitPidExitedNoHang now returns terminating signal info - ProcessWaitState: tracks terminating signal for ProcessExitStatus - Ref assembly: updated with new API surface - Tests: added comprehensive WaitForExit* tests Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/3540beba-26c4-4014-b276-d6fa244eda82 Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
…e ToTimeoutMilliseconds to ProcessUtils, remove KillCore, fix platform attributes, update native PAL - ProcessWaitState: store ProcessExitStatus? instead of separate _exitCode/_terminatingSignal - Native PAL: use TryConvertSignalCodeToPosixSignal for proper PosixSignal mapping - Move ToTimeoutMilliseconds to ProcessUtils.cs, reuse from Process and SafeProcessHandle - Remove separate KillCore methods on both platforms; use SignalCore on Unix, TerminateProcessCore on Windows - Remove platform attributes from WaitForExit, TryWaitForExit, WaitForExitAsync (non-killing methods) - Fix CreateExitStatus canceled logic: canceled && signal is not null - Update Process.Unix.cs to consume ProcessExitStatus? from GetExited Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/1a601c8b-3c5f-4596-9b8f-5e11188e35ae Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
…ssCore Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/1a601c8b-3c5f-4596-9b8f-5e11188e35ae Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
… pragma, simplify Unix async via ProcessWaitState.WaitForExitAsync, add PlatformNotSupportedException checks, rename wasKilled to signalWasSent, add Debug.Assert, update ProcessHandlesTests.Windows.cs Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/603f063f-b34a-42f8-ab6b-e1aa2df62675 Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
- there is no need to start suspended process anymore, as we can wait on the handle to exit directly - revert changes I did not like
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tests - Fix GetWaitState() on Unix to lazily initialize _waitState from ProcessWaitState table so that SafeProcessHandle from Process.SafeHandle works for WaitForExit* - Add _lazyWaitStateHolder field to properly manage ref count lifecycle - Convert signal test from Fact to Theory with SIGKILL and SIGTERM - Add Process.SafeHandle WaitForExit* tests to ProcessWaitingTests Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/52916352-c074-4483-8dca-72cf3696462e Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
…, rename test methods Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/52916352-c074-4483-8dca-72cf3696462e Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
- Use WaitInMS timeout at line 55 per reviewer suggestion - Merge two WaitForExit_ProcessExitsNormally tests into one - Merge sync/async WaitForExit into theory with bool useAsync - Merge sync/async WaitForExitOrKill normal-exit into theory - Merge sync/async WaitForExitOrKill timeout/cancel into theory Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/3a1553e0-3850-4588-b95f-5452296a0275 Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
…ocessId) matching Process pattern Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/3f4f9d58-e237-49c2-9220-e41731a20fde Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
…e lazy init All SafeProcessHandle instances are now created with a ProcessWaitState: - Added Holder(Holder) copy constructor to ProcessWaitState.Holder - Added IncrementRefCount() to ProcessWaitState for ref counting - SafeProcessHandle now owns its own Holder copy (disposed in ReleaseHandle) - Made _waitState readonly, removed _lazyWaitStateHolder and EnsureWaitStateInitialized - Updated GetProcessHandle() in Process.Unix.cs to pass Holder when creating SafeProcessHandle Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/a866727c-2478-4cdc-a3ec-6ce0e20f929e Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…-child process on Unix Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/fb9ffb85-16b8-436b-b588-0f5527b85606 Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/233caaed-255c-439e-88f8-2add4a7073d5 Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
…Async APIs Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/6d89c552-8d80-40db-bf17-c2f9effc55ca Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
adamsitnik
left a comment
There was a problem hiding this comment.
@copilot please address my feedback
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Tagging subscribers to this area: @dotnet/area-system-diagnostics-process |
…elpers, fix timeout tracking, reuse MapToArgumentList Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/840381dc-b4f5-46ce-a7ed-bdde61b0ca90 Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/c47fa8e9-5961-4cf0-aed3-da97948d0e36 Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
…ting Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/73a14058-c419-4277-b5e2-885c9c6c8607 Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com>
…lOnCancellationAsync Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/73a14058-c419-4277-b5e2-885c9c6c8607 Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/73a14058-c419-4277-b5e2-885c9c6c8607 Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/73a14058-c419-4277-b5e2-885c9c6c8607 Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com>
All feedback addressed in separate commits:
All 40 RunTests and 10 StartAndForgetTests pass. |
…Async APIs - Run/RunAsync: synchronously/asynchronously starts a process, waits for exit, returns ProcessExitStatus - RunAndCaptureText/RunAndCaptureTextAsync: starts a process, captures stdout/stderr, returns ProcessTextOutput - PSI overloads for RunAndCapture* require RedirectStandardOutput and RedirectStandardError to be enabled - String overloads use CreateStartInfoForCapture helper to set redirect flags - All async methods always use WaitForExitOrKillOnCancellationAsync - Comprehensive tests for all API parameters and permutations Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>

copilot/implement-issue-126293was merged into main as PR Implement SafeProcessHandle.WaitForExit* methods #127022CreateStartInfoForCapturehelper that sets redirect flagsWaitForExitOrKillOnCancellationAsync(CanBeCanceled check is already inside that method)