-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix child process spawning on linux #773
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
Conversation
src/process.cpp
Outdated
@@ -150,12 +150,14 @@ int proc_t::execute(int app_id) { | |||
find_working_directory(cmd, _env) : | |||
boost::filesystem::path(proc.working_dir); | |||
BOOST_LOG(info) << "Spawning ["sv << cmd << "] in ["sv << working_dir << ']'; | |||
auto child = platf::run_unprivileged(cmd, working_dir, _env, _pipe.get(), ec); | |||
bp::group child_group; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I don't really like this myself that there is a need to pass a temporary group, but I don't know how to do it optionally without creating 2 function versions. The boost::child
constructor is just meh...
Got an advice that temporary group could have had some strange behavior on Windows, so duplicating code instead :/ |
@cgutman Sorry to tag you like this, but could I ask for a review from you? Since I know you're more knowledgeable about |
It seems that ctor does not accept PID with other arguments. Since it was working this way on Windows before and it's only broken on linux, the child can be added to the group manually via method. |
Description
This solves a bug introduced accidentally by #600.
When starting an attached command/process on linux, you are welcomed by this error:

It seems that for whatever reason, if your child is going to be in a process group, it has to be in it from the start boostorg/process#164 in order for the group methods to work properly.
Type of Change
.github/...
)Checklist
Branch Updates
LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.