Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Foreground Job Control Overhaul #661
Job control in Ion was a complete mess, and it was a wonder that it even worked at one point to begin with! I've gone through and fixed a number of issues related to foreground job management.
There's likely some issues that remain to be addressed though. Needs more testing & bug reports. Background job management remains to be mostly broken for now, so that's an area to look into next.
This resolves a number of significant issues with the way that foreground jobs were being handled. However, let it be known that there is an issue introduced by this commit which causes the piped Ion scripts to fail, due to some outputs getting mixed up. Therefore, be cautious about using Ion for scripts at the moment. I will look into a fix for the issue tomorrow.
Processes within a pipeline should have the same PGID. As this was not the case, this commit will fix that problem. In addition, processes within a pipeline should be SIGSTOP'd before they begin execution, and then SIGCONT'd in the parent when the next job in line is also SIGSTOP'd. This allows commands earlier in the queue to properly receive the SIGPIPE signal so that commands like `yes | head` will function properly. I've also refactored quite a bit of code within the pipeline execution module, and have rewritten external command execution to use fork + execve instead of the Command functionality in the standard library. As every other piece of functionality in Ion depends upon fork+exec behavior, it is therefore ideal that external command execution also works in the same way. This will allow me to do further refactoring in the near future, and to diagnose some issues that I'm having. NOTE: Ion remains to be broken with this commit, so I don't recommend to use Ion until this work is complete.
This is a continuation of the previous commit, and with this change many things will start working again. The usage of `std::process::Command` caused a number of issues that are now resolved with this change.