Conversation
…ation and stream setup to Process.cs Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
…nterop.Pipe.cs to csproj Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
…eAnonymousPipe directly, simplify Windows StartWithCreateProcess Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
- STARTF_USESTDHANDLES is always provided now - we may use more flags in the future - so ProcessWindowStyle tests should check only if STARTF_USESHOWWINDOW (1) was applied
…n Android (it's not supported)
… 0/1/2; remove Android checks from Process.cs Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
…rning fd 0/1/2; remove Android checks from Process.cs" This reverts commit bba0144.
…artInfo Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
…pen property, improve XML docs Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/9f61c68e-edfd-42e9-b86b-bfb9ee7d8946
…ullHandle/OpenStandard*Handle APIs, remove redundant Close() calls Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/29b43a66-dcf9-47b0-95df-28d834129305
…ndle nullable handles Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/264e5c0b-daf2-4f32-80ec-10fdf888c120
…eam (possibly a terminal) Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/264e5c0b-daf2-4f32-80ec-10fdf888c120
…ot/add-standard-input-output-properties
…() calls, add LeaveHandlesOpen test Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/6c515d2e-34b7-483e-a1e5-2b0fae3caad8
- add more tests - fix bugs - handle edge cases
…/ErrorHandle, fix docs, add handle validation Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/7c3e65ca-2e62-4821-b8d2-0bc9bde12049
|
@tmds @wfurt could you please review this PR? The motivation is to later be able to use As a nice bonus we get MASSIVE perf boost for starting processes on macOS (EgorBot/Benchmarks#76): BenchmarkDotNet v0.15.8, macOS Sequoia 15.4.1 (24E263) [Darwin 24.4.0]
Apple M4, 1 CPU, 10 logical and 10 physical cores
.NET SDK 11.0.100-preview.3.26176.102
[Host] : .NET 10.0.5 (10.0.5, 10.0.526.15411), Arm64 RyuJIT armv8.0-a
cc @stephentoub I believe it may be worth including in .NET 11 perf blog post ;) |
|
@copilot invoke the code-review skill and post the analysis/results as a comment on this PR |
This comment has been minimized.
This comment has been minimized.
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/07d6b7fd-ffb6-446d-9935-dd72dbcd4361 Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
🤖 Copilot Code Review — PR #126063Note This review was generated by Copilot using the code-review skill, with cross-model analysis (Claude, Gemini, GPT). Nits found during review were fixed in commit 54f7706. Holistic AssessmentMotivation: Well-justified. Using Approach: The approach is sound — adding Summary: Detailed Findings✅ Error handling and resource cleanup — CorrectAll error paths properly destroy ✅ Signal default set construction — Correct parity with fork pathThe loop at lines 260-275 correctly mirrors the fork path's child-side signal handler reset (lines 435-451): iterates signals 1..NSIG, skips SIGKILL/SIGSTOP, uses ✅ Signal mask capture — Correct
✅
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
🤖 Copilot Code Review — PR #126063Note This review was generated by GitHub Copilot. Holistic AssessmentMotivation: Justified. Approach: Sound. The implementation correctly mirrors the fork path's signal-handling behavior (resetting only custom handlers, preserving Summary: Detailed Findings✅ Exec-Error Propagation — Correct for macOSThe fork path uses a The fork path's pipe also served as a "wait until exec" synchronization barrier. With posix_spawn, this is implicit — (Verified by: tracing the managed call chain from ✅ Signal Handling — Matches Fork PathThe posix_spawn path's signal-reset logic (lines 258-276) closely mirrors the fork path's (lines 436-452):
✅
|
adamsitnik
left a comment
There was a problem hiding this comment.
All the Unix CI legs are green. The perf win is HUGE, please let me know if you need any changes to get it merged.
wfurt
left a comment
There was a problem hiding this comment.
LGTM. I left few comments, mostly technicalities. Feel free to update it as separate change if you want to get this in @adamsitnik
why not there? |
posix_spawn is supported on iOS, but has very strict requirements and we are not sure whether we want to support it on iOS or not (#126097 (comment)) |
|
/ba-g failures are unrelated |
Description
Uses
posix_spawninstead offork/execinSystemNative_ForkAndExecProcesson macOS.#if defined(TARGET_OSX), placed as the first code block in the function — restricts the path to macOS only (excludes iOS, tvOS, MacCatalyst, watchOS)setCredentialsis true, falls through to the existingfork/execpath since macOSposix_spawndoes not supportsetuid/setgid*childPid = -1early (right after the assert) so all error returns consistently report failure; only overwritten with the spawned PID on the happy pathPOSIX_SPAWN_SETSIGDEFandPOSIX_SPAWN_SETSIGMASKfor parity with the fork path. The sigdefault set is built by iterating signals 1..NSIG, skippingSIGKILL/SIGSTOP, and only including signals with custom handlers (preservingSIG_IGNandSIG_DFLhandlers) — re-uses the existinghandler_from_sigactionhelper without code duplication. The signal mask captures the parent's current mask via a standalonepthread_sigmaskcall (with its own error handling block) and passes the result toposix_spawnattr_setsigmaskin a compound||conditional alongsideposix_spawnattr_setflags,setsigdefault,setsigmask, andfile_actions_initwith shared error handlingposix_spawn_file_actions_adddup2for stdin/stdout/stderr, skipping when fd is-1posix_spawn_file_actions_addchdir_npdirectly (always available on supported macOS versions, noHAVE_constant)POSIX_SPAWN_CLOEXEC_DEFAULT(separate PR), nocreate_suspended, nocreate_new_process_groupChildProcess_InheritsParentSignalMask_CanReceiveSignalstest inProcessTests.Unix.csthat usesRemoteExecutorandPosixSignalRegistrationto verify a child process started from a parent with registered signal handlers can still receive signals correctly; skipped on Windows via[SkipOnPlatform(TestPlatforms.Windows)]since SIGCONT is not supported therefixes #126097