fix: kill child progress fail

This commit is contained in:
DreamMaoMao 2025-05-03 19:34:25 +08:00
parent 3d64bcb205
commit b75dc1a293

View file

@ -2495,9 +2495,10 @@ void cleanup(void) {
#endif #endif
wl_display_destroy_clients(dpy); wl_display_destroy_clients(dpy);
if (child_pid > 0) { if (getpgid(child_pid) == child_pid) { // 检查是否是进程组 leader
kill(-child_pid, SIGTERM); kill(-child_pid, SIGTERM); // 是,则杀死整个进程组
waitpid(child_pid, NULL, 0); } else {
kill(child_pid, SIGTERM); // 否,只杀死单个进程
} }
wlr_xcursor_manager_destroy(cursor_mgr); wlr_xcursor_manager_destroy(cursor_mgr);