mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-06 13:29:53 -05:00
opt: optimize run autostart script
This commit is contained in:
parent
d80fb44e72
commit
fc94c44dab
1 changed files with 21 additions and 21 deletions
|
|
@ -2513,10 +2513,9 @@ void cleanup(void) {
|
|||
#endif
|
||||
|
||||
wl_display_destroy_clients(dpy);
|
||||
if (getpgid(child_pid) == child_pid) { // 检查是否是进程组 leader
|
||||
kill(-child_pid, SIGTERM); // 是,则杀死整个进程组
|
||||
} else {
|
||||
kill(child_pid, SIGTERM); // 否,只杀死单个进程
|
||||
if (child_pid > 0) {
|
||||
kill(-child_pid, SIGTERM);
|
||||
waitpid(child_pid, NULL, 0);
|
||||
}
|
||||
wlr_xcursor_manager_destroy(cursor_mgr);
|
||||
|
||||
|
|
@ -5035,6 +5034,7 @@ run(char *startup_cmd) {
|
|||
if ((child_pid = fork()) < 0)
|
||||
die("startup: fork:");
|
||||
if (child_pid == 0) {
|
||||
setsid();
|
||||
dup2(piperw[0], STDIN_FILENO);
|
||||
close(piperw[0]);
|
||||
close(piperw[1]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue