-
Notifications
You must be signed in to change notification settings - Fork 88
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
retrieve PID of child process #132
Comments
Does it not suffice to kill the Shelly program? Is this for a background process? |
A long running program that manages the launching, activities, and termination of executables forked into the background. All Posix shells have the ability to retrieve the process id of child processes, partly for the reason I've stated. |
I am certainly not opposed to adding this functionality, but I have always found shell scripts to be very poor vehicles for running background jobs and supervising. I did create a module that I used for the purpose of speeding up a script by running some tasks concurrently. http://hackage.haskell.org/package/shelly-extra-0.3.0.1/docs/Shelly-Background.html |
shelly runs |
These are the suspects: createProcess :: CreateProcess -> IO (..., ProcessHandle) Time to expose the System.Posix.Types.CPid. |
I have code for Shelly that makes possible the exposing of the PID, et al. and much needed code for OS level job control. It involves the addition of two State record fields: a Maybe callback, and a Bool to signal the creation of fresh process groups (vital for job control and signalling). Two accessor methods setCallback and setCreateProcessGroup. Beyond that there are a handful of lines to support the functionality in Shelly.hs. At no time is Shelly encumbered with code to actually expose the PID, just the ProcessHandle. The PID can be extracted easily by the caller's callback function and allies. Let me know how you would like me to proceed. |
Shelly is missing the ability to provide the process id of a child process. This becomes essential if the child process runs amok, which happens in the real world. With the id of the feral child process in hand it can be killed with prejudice when necessary.
The text was updated successfully, but these errors were encountered: