Skip to content
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

Install a SIGCHLD handler, and allow wait() and also getting the exit code #5

Closed
gaborcsardi opened this issue Mar 9, 2017 · 7 comments

Comments

@gaborcsardi
Copy link
Contributor

gaborcsardi commented Mar 9, 2017

The SIGCHLD handler will be incompatible with the parallel package, which just removes the old handler and installs a new one. So ideally, parallel needs a fix, too.

@gaborcsardi
Copy link
Contributor Author

Of course this is only for Unix. I don't know how you would do this on Windows....

@gaborcsardi
Copy link
Contributor Author

Btw. you definitely need a SIGCHLD handler, because currently sys leaves zombie processes around...

@gaborcsardi
Copy link
Contributor Author

Related to this, I would like to have the exit status of the background process as well, without waiting on it, of course.

On Unix the SIGCHLD signal handler can get the exit status, and there is also a way to get it on Windows. But where should sys store the exit status? If we had process objects or some handle, then we could store it in the handle object. So how about making an exec_background version that returns a handle instead of a pid?

@gaborcsardi
Copy link
Contributor Author

Another, slightly hackier solution is to return the pid, but add some attribute that will be essentially the handle. It should be an external pointer, so that it has reference semantics.

Personally I think that just having a new function that returns a handle is cleaner. exec_with_handle() or sg like that.

@gaborcsardi
Copy link
Contributor Author

Just tell me which one to implement, and then I'll do it. :)

@jeroen
Copy link
Owner

jeroen commented Mar 11, 2017

Sorry I got silent, it was late. Reviewing now.

@jeroen
Copy link
Owner

jeroen commented Nov 5, 2018

In sys we temporarily block SIGCHLD for blocking calls, which ensures there are no side effects. Users that want more control should switch to processx.

@jeroen jeroen closed this as completed Nov 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants