Repository navigation
Restrict handle inheritance in Process convenience APIs - #136648
Open
adamsitnik wants to merge 1 commit into
Open
adamsitnik wants to merge 1 commit into
adamsitnik wants to merge 1 commit into
Conversation
Default filename/argument Run and StartAndForget overloads to an empty inherited-handle list. Document and test the defaults, and simplify runtime test callers to use these overloads. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b56f030a-6967-43bf-9b78-2a83168f750c
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-diagnostics-process |
Member
|
This is breaking change, correct? What will be the justification for the breaking change? |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
InheritedHandles = []in the shared factory for all fiveProcess.Run*andProcess.StartAndForgetoverloads that accept a file name and argument collection. Overloads accepting a caller-providedProcessStartInforemain unchanged.silentvalues where applicable.ProcessStartInfowhere custom settings are needed.Additional handle inheritance now requires using a
ProcessStartInfooverload. Standard-handle behavior is unchanged.Validation
Tested locally on Windows x64:
.\dotnet.cmd build src\libraries\System.Diagnostics.Process\src\System.Diagnostics.Process.csproj -p:Configuration=Release -p:RunAnalyzersInBuild=truepassed with no warnings or errors..\dotnet.cmd build /t:Test src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj -p:Configuration=Releasecompleted with 700 passed, 2 skipped, and 1 failed. The failure wasProcessHandlesTests.ChildProcess_CanBreakAwayFromJob(killOnParentExit: False): Windows returnedWin32Exception(5): Access is deniedin theWindowsProcessStartArgumentscallback, outside the convenience overloads changed here..\dotnet.cmd build src\tests\Common\XUnitLogChecker\XUnitLogChecker.csproj -p:Configuration=Release -p:RunAnalyzersInBuild=truepassed with no warnings or errors..\dotnet.cmd build src\tests\run.cs -o artifacts\process-overload-runner -p:RunAnalyzersInBuild=truepassed.System.Diagnostics.Processassembly throughCORE_LIBRARIES..cmdwrapping, paths/arguments containing spaces, empty arguments,ComSpecfallback, stdout/stderr capture, diagnostics, and startup failures. The loaded Process assembly was checked against the local build's SHA-256 hash.git diff --checkpassed.Linux-specific and NativeAOT-specific scenarios were compiled but not executed. The full runtime test suite was not run.
Local measurements
A short Windows BenchmarkDotNet run compared an unrestricted
ProcessStartInfocontrol with the restricted file-name/arguments overloads, launchingcmd.exe /d /c exit 0.ProcessStartInfoRunRunAndCaptureTextThis used the same locally built Process assembly, the in-process emit toolchain, three warmups, eight measured iterations, and 128 invocations per iteration. It is not a historical-binary comparison, and the short run does not establish a performance improvement or regression.
Note
This pull request description and code changes were generated with GitHub Copilot.