-
Notifications
You must be signed in to change notification settings - Fork 67
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
Ability to spawn child processes and send signals to them. #482
Comments
|
I wanted to emulate something like this in joker.
|
I added two functions in
@amano-kenji Do you think this will work? Would you be willing to build that branch locally and try it for your use case? |
I compiled and tested it. That seems to do the job, but what about control over stdout, stderr, stdin, and current working directory? |
I wonder if it'd make sense to enhance That way, the features provided by I think an alternate to |
Yes, I think it makes sense. I was not sure how useful it would be to be able to set up stdin/out/err for processes that are started asynchronously and how this would behave when the process is killed by the parent program. I'll experiment with this on the weekend. |
I may want to redirect stdout and stderr to /dev/null and feed some input to stdin. |
@amano-kenji , @jcburley I made the change so that now
Please let me know what you think. |
That should do the job although being able to send other signals than TERM to a process is going to be useful. |
@amano-kenji Fair enough. I added |
I just tested. If I Also, it would be cool to have predefined SIGNALs for |
@amano-kenji Zombie processes are sort of normal: https://www.baeldung.com/linux/clean-zombie-process As for predefined signals, they are platform specific. We would have to expose different set of constants on different platforms (at least on three officially supported platformes: Linux, macOS and Windows). I don't believe we do this anywhere else in Joker's codebase. @jcburley do you have any input on this (perhaps you've done this in your fork?) |
My fork's So it doesn't really handle this in any particularly sophisticated way, in that the constants and variables that get wrapped, for a specific Joker executable, are just whatever happen to apply to that particular target. I.e. the Joker namespaces that get exposed, along with their contents, in a particular executable, depend on what makes sense for that executable's target. Things that are Mac-OS-specific will appear, as namespaces and/or entities within them, in a Joker executable built for the Mac OS platform, but not on one built for a Linux nor Windows platform. Early on, I thought it might be possible to someday make But that seems very difficult, with little (if any) benefit, other than that my "fork" could then just be a source distribution without any need to run So I've punted that capability, which is Issue jcburley#10. |
@jcburley thank you for the input! Here is my attempt to add support for platform-dependent declarations (non-functions) in std library: 2db1f41 This means that, e.g. This complicates build process a bit since now you have to generate std library for specific OS. Not sure how I feel about it... I guess it's useful to be able to write |
I guess the alternative to this would be to only define signals that have the same value across all platforms. Now that I look at it, most common/useful signals fall into that category (e.g. SIGKILL, SIGTERM, SIGABRT). So perhaps it makes sense to punt on platform-dependent declaration for now until there is a more compelling use case for it? |
It's sufficient to add only platform-independent signals. |
OK, I've removed OS-dependent signals for now and merged everything to master. Closing. |
I want to spawn child processes and kill them later. Or, do child processes get killed when the parent dies?
The text was updated successfully, but these errors were encountered: