Add support in dotnet run for pid files#1393
Add support in dotnet run for pid files#1393victorhurdugaci wants to merge 1 commit intorel/1.0.0from
Conversation
| syntax.DefineOption("f|framework", ref runCmd.Framework, "Compile a specific framework"); | ||
| syntax.DefineOption("c|configuration", ref runCmd.Configuration, "Configuration under which to build"); | ||
| syntax.DefineOption("p|project", ref runCmd.Project, "The path to the project to run (defaults to the current directory). Can be a path to a project.json or a project directory"); | ||
| syntax.DefineOption("pf|pid-file", ref runCmd.PidFile, "A file that contains the process id of the executed application"); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
I've been wishing CoreFx on POSIX systems had a way to listen for SIG*. |
|
@stephentoub, @Priya91 , Thoughts? We've had this item in the backlog for a while. https://github.com/dotnet/corefx/issues/3188 |
|
I'm not following the thread, but if the concern is around lack of graceful shutdown in response to SIGTERM, there's https://github.com/dotnet/coreclr/issues/2688 |
|
@stephentoub we need this feature for |
|
@victorhurdugaci, thanks, but I'm not understanding the connection to the comments about graceful shutdown and signal handling. Can you elaborate? What feature of corefx/coreclr is desired here to address this situation? |
|
@stephentoub we just need a cross platform mechanism to signal and gracefully shutdown a process. That way, |
|
Ah, I understand now. Well, using AssemblyLoadContext.Unloading (https://github.com/dotnet/corefx/blob/master/src/System.Runtime.Loader/ref/System.Runtime.Loader.cs#L37) you can register to be notified when your process is gracefully exiting (e.g. because Environment.Exit is called), and with https://github.com/dotnet/coreclr/issues/2688 (cc: @kouvel) this should be triggered in response to a SIGTERM signal. It sounds then like then you're simply wanting the ability to send a SIGTERM on Unix, and you can do so with a P/Invoke to |
|
Or, are you asking for something else, like the ability to manually send (the equivalent of) ctrl-C to another process on both Windows and Unix? |
|
Kill and entire process tree |
|
@stephentoub @davidfowl yup, ultimately the goal is to kill an entire process tree |
|
Since you're already in the world of launching this or that utility, have you considered just launching the various utilities to kill a whole process tree, e.g. |
|
@stephentoub that's an interesting idea which might work. Let me give it a try and maybe we don't need this PR after all |
|
@stephentoub that seems to work. I'll close this PR for now |
|
@stephentoub Apparently |
I don't know what utilities are available there. I don't have a great suggestion with what's available... even in the full framework, there's no There are other workarounds one could imagine. For example, the parent process could pass its ID ( |
Add support for dropping a pid file. The watcher needs it because otherwise it cannot kill the process started by
dotnet runcc @piotrpMSFT @anurse