-
Notifications
You must be signed in to change notification settings - Fork 170
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
simplify run() to use daemon(3) #1596
Conversation
608fd02
to
953ebd4
Compare
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.
Also the formatting is off, see the CI logs for a patch you can apply to fix the code style.
|
||
/* The following is a "hack" for disowning the child processes, |
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.
I think the comment should stay. We still do a double fork (even though daemonize does it for us), and I think that the purpose of this may not be clear to all readers.
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.
readded
pid_t child_pid; | ||
read(pipe_fd[READ_END], &child_pid, sizeof(child_pid)); | ||
#endif | ||
execl("/bin/sh", "/bin/sh", "-c", command.c_str(), NULL); |
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.
I see you have removed the _exit()
call. Wouldn't that cause issues if execl
fails?
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.
I still do have the _exit
but it's moved above to line 787.
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.
Yeah but the exit should happen after a failed exec
Ping? |
current method is a 'hack' and using daemon(3) reduces code burden by reusing standard libraries. Signed-off-by: Aisha Tammy <aisha@bsd.ac>
Signed-off-by: Aisha Tammy <aisha@bsd.ac>
Signed-off-by: Aisha Tammy <aisha@bsd.ac>
src/api/wayfire/core.hpp
Outdated
@@ -274,7 +274,7 @@ class compositor_core_t : public wf::object_base_t, public signal::provider_t | |||
* This also sets some environment variables for the new process, including | |||
* correct WAYLAND_DISPLAY and DISPLAY. | |||
* | |||
* @return The PID of the started client, or -1 on failure. | |||
* @return The PID of the started client, or 0 on failure. |
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.
Can we avoid breaking changes like this? I think we can easily continue returning -1 on failure.
Thanks for the PR but I have decided not to accept it. I think this PR makes much more than the title suggests - simply using daemon instead of fork might be a good idea, using anything more complicated than pipes is not. |
current method is a 'hack' and using daemon(3)
reduces code burden by reusing standard libraries.
Signed-off-by: Aisha Tammy aisha@bsd.ac