Skip to content

ProcessTests: redirect stdio and kill entire process tree for shell-script-based tests.#127566

Open
tmds wants to merge 3 commits intodotnet:mainfrom
tmds:fix-process-test-leftover-sleep
Open

ProcessTests: redirect stdio and kill entire process tree for shell-script-based tests.#127566
tmds wants to merge 3 commits intodotnet:mainfrom
tmds:fix-process-test-leftover-sleep

Conversation

@tmds
Copy link
Copy Markdown
Member

@tmds tmds commented Apr 29, 2026

The LongProcessNamesAreSupported and ProcessNameMatchesScriptName tests spawn a shell script that runs sleep as a grandchild. Killing only the shell left the sleep process alive, holding stdout/stderr pipes open for the parent that runs the tests.

@dotnet/area-system-diagnostics-process ptal.

…cript-based tests.

The LongProcessNamesAreSupported and ProcessNameMatchesScriptName tests spawn a shell script that runs sleep as a grandchild.
Killing only the shell left the sleep process alive, holding stdout/stderr pipes open for the parent that runs the tests.
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Apr 29, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-diagnostics-process
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it LGTM, but I wonder why do we need to redirect std OUT and ERR here.

Comment thread src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs Outdated
Comment thread src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs Outdated
Comment thread src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs
Copy link
Copy Markdown
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmds thank you for your contribution

After my experience in dotnet/sdk#54093 (comment) I believe we are going to have to implement #119650 as well and simply produce warnings for Process usages that enable redirection without consuming produced out/err. Thanks!

Comment thread src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs Outdated
Comment thread src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs Outdated
Comment thread src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs Outdated
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Copy link
Copy Markdown
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tmds I am going to apply the last suggestion and enable auto merge, I hope you don't mind

Comment thread src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Diagnostics.Process community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants