-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Process termination #49335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Process termination #49335
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR simplifies process termination by unifying code paths and centralizing the handling of process cancellation via a dedicated ProcessRunner instance. Key changes include:
- Replacing static process termination calls with an instance-based ProcessRunner that accepts a cancellation token.
- Updating various methods across tests and production code to incorporate caller information for logging and to align with the new ProcessRunner pattern.
- Adjusting reporter messages and test expectations to match the unified termination behavior.
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
test/dotnet-watch.Tests/Watch/Utilities/WatchableApp.cs | Updated types and assertions to use DebugTestOutputLogger and new caller info. |
test/dotnet-watch.Tests/Utilities/MockFileSetFactory.cs | Revised instantiation including a redundant ternary expression for environment options and addition of ProcessRunner argument. |
test/dotnet-watch.Tests/MsBuildFileSetFactoryTest.cs, NoRestoreTests.cs, MSBuildEvaluationFilterTest.cs, ... | Updated tests to consistently instantiate and pass ProcessRunner. |
src/BuiltInTools/dotnet-watch/Program.cs, DotNetWatcher.cs, DotNetWatchContext.cs, ... | Revised process creation and termination calls to use ProcessRunner and updated reporter messaging. |
src/BuiltInTools/dotnet-watch/Internal/ProcessRunner.cs | Refactored process termination logic to be instance-based and added asynchronous helper methods. |
src/BuiltInTools/dotnet-watch/HotReload* | Updated hot-reload related components to work with the new process termination logic. |
only failure was from the known container issue that dnceng is working on. Requested to merge on red |
Simplify process termination. Unify two code paths that were used to gracefully terminate process to a single one.
Converts
ProcessRunner
to an object that stores cancellation token that is triggered by Ctrl+C. Then use it inProcessRunner
methods to detect whether the process termination was initiated via Ctrl+C or otherwise.