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

fix: void register signal handler for SIG_CHILD #54

Merged
merged 1 commit into from
May 31, 2023

Conversation

black-desk
Copy link
Contributor

@black-desk black-desk commented May 19, 2023

linuxdeepin/developer-center#4412

QProcess::execute will use waitid to get exit code of that process it
starts. Register SIG_CHILD and wait all dead childs will break this
mechanism, as QProcess will find out that there is no child to wait,
and report this situation as a child process exit by crash.

So I change the method of launch application to use a double fork, to
start process and detach. Just as the way QProcess get this job done
in its startDetached method.

As a quick fix, I change the signature of launch method as no one use
its return value currently. If this is need someday, we should use a
pipe to let double forked child process report the return value and
errno of its exec call.

@black-desk black-desk marked this pull request as ready for review May 19, 2023 08:09
@black-desk black-desk changed the title Fix a signal issue fix: void register signal handler for SIG_CHILD May 19, 2023
@black-desk black-desk force-pushed the black-desk/fix/wait branch 2 times, most recently from 759fcf4 to 2365b90 Compare May 19, 2023 08:14
@black-desk black-desk requested a review from zccrs May 19, 2023 08:58
src/modules/startmanager/startmanager.cpp Outdated Show resolved Hide resolved
src/modules/startmanager/startmanager.cpp Outdated Show resolved Hide resolved
@black-desk
Copy link
Contributor Author

@zccrs

@black-desk black-desk requested a review from BLumia May 29, 2023 02:07
@justforlxz
Copy link
Member

/+1

linuxdeepin/developer-center#4412

QProcess::execute will use waitid to get exit code of that process it
starts. Register SIG_CHILD and wait all dead childs will break this
mechanism, as QProcess will find out that there is no child to wait,
and report this situation as a child process exit by crash.

So I change the method of launch application to use a double fork, to
start process and detach. Just as the way `QProcess` get this job done
in its `startDetached` method.

As a quick fix, I change the signature of `launch` method as no one use
its return value currently. If this is need someday, we should use a
pipe to let double forked child process report the return value and
errno of its `exec` call.

Signed-off-by: black-desk <me@black-desk.cn>
@black-desk black-desk merged commit 2f96944 into linuxdeepin:master May 31, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants