-
Notifications
You must be signed in to change notification settings - Fork 27
Add a few things to make $&waiting more flexible.
#149
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
base: master
Are you sure you want to change the base?
Conversation
Also add $&sigmessage primitive.
|
Some caveats/potential alternatives:
A number of the questions I have are in the general category of when we would want to have |
|
Here's something potentially interesting that It's only a sketch (note the awkward use of A more process-group-aware es could also account for stopped children in some intelligent way in |
This PR combines: - PR wryun#149, "Add a few things to make $&waiting more flexible." - PR wryun#90, "Use the %run hook function for running binaries." - A heap of new logic in proc.c and prim-sys.c, generally much cleaner than in the original newjobcontrol branch - Support for '+signame' signal handling to sig_ignore in the shell pgrp - A draft share/job-control.es script Overall things seem pretty solid. It even builds and runs successfully right now with `-ansi -D_POSIX_C_SOURCE=200112L -pedantic -DGCDEBUG=1`, which is a pleasant surprise. It still needs: - A lot of testing - Some more refactoring of pgroup handling, especially around exit statuses - Follow-up on WCONTINUED and WIFCONTINUED alternatives in POSIX.1-2001 (or whether ifdef'ing is worth it) - A way to hook the %interactive-loop to add signal handlers and run newpgrp on startup (this is a blocker to running job-control.es from .esrc right now)
This PR combines: - PR wryun#149, "Add a few things to make $&waiting more flexible." - PR wryun#90, "Use the %run hook function for running binaries." - A heap of new logic in proc.c and prim-sys.c, generally much cleaner than in the original newjobcontrol branch - Support for '+signame' signal handling to sig_ignore in the shell pgrp - A draft share/job-control.es script Overall things seem pretty solid. It even builds and runs successfully right now with `-ansi -D_POSIX_C_SOURCE=200112L -pedantic -DGCDEBUG=1`, which is a pleasant surprise. It still needs: - A lot of testing - Some more refactoring of pgroup handling, especially around exit statuses - Follow-up on WCONTINUED and WIFCONTINUED alternatives in POSIX.1-2001 (or whether ifdef'ing is worth it) - A way to hook the %interactive-loop to add signal handlers and run newpgrp on startup (this is a blocker to running job-control.es from .esrc right now)
This PR combines: - PR wryun#149, "Add a few things to make $&waiting more flexible." - PR wryun#90, "Use the %run hook function for running binaries." - A heap of new logic in proc.c and prim-sys.c, generally much cleaner than in the original newjobcontrol branch - Support for '+signame' signal handling to sig_ignore in the shell pgrp - A draft share/job-control.es script Overall things seem pretty solid. It even builds and runs successfully right now with `-ansi -D_POSIX_C_SOURCE=200112L -pedantic -DGCDEBUG=1`, which is a pleasant surprise. It still needs: - A lot of testing - Some more refactoring of pgroup handling, especially around exit statuses - Follow-up on WCONTINUED and WIFCONTINUED alternatives in POSIX.1-2001 (or whether ifdef'ing is worth it) - A way to hook the %interactive-loop to add signal handlers and run newpgrp on startup (this is a blocker to running job-control.es from .esrc right now)
64361a8 to
a23a7a0
Compare
This PR adds a few things:
First, an
-nflag forwait, which corresponds withwaitpid(WNOHANG). This can be used to implement acheck-waitfunction during%prompt, something some shells do automatically.To support that use case, there is a new hook function
%echo-status, which is called when any process isewait()ed for, and performs the work of printing the "interesting" signal terminations. A default implementation is provided which should be the same as the current behavior. A quick-and-dirty way to hack on this function is to simply setfn-%echo-status = echoto see how every process exits:To make a backwards-compatible
%echo-statuspossible, this PR also adds a new$&sigmessageprimitive which externalizes thesigmessage()function. This seems generally useful for signal exception handlers as well; the%interactive-loopfunction has been modified to use this primitive.Putting these all together, the following enables the "check-wait" behavior on prompt like in other, job controlling shells: