|
|
@ -55,7 +55,6 @@ void process_exec(process *proc) { |
|
|
|
log_perror("%s fork error -> ", proc->name); |
|
|
|
server_exit(EXIT_FORK_ERROR); |
|
|
|
} else if (pid == 0) { // child process
|
|
|
|
log_debug("Subprocess fork success -> PID = %d", getpid()); |
|
|
|
if (chdir(proc->cwd)) { // change working directory
|
|
|
|
log_perror("%s with invalid cwd `%s` -> ", proc->name, proc->cwd); |
|
|
|
exit(EXIT_EXEC_ERROR); |
|
|
@ -155,11 +154,11 @@ void get_exit_signal() { // get SIGINT or SIGTERM signal |
|
|
|
|
|
|
|
void get_sub_exit() { // catch child process exit
|
|
|
|
if (EXITING) { |
|
|
|
log_debug("Skip SIGCHLD signal"); |
|
|
|
log_debug("Skip handle SIGCHLD"); |
|
|
|
return; |
|
|
|
} |
|
|
|
int status; |
|
|
|
log_debug("Handle SIGCHLD begin"); |
|
|
|
log_debug("Start handle SIGCHLD"); |
|
|
|
for (process **proc = process_list; *proc != NULL; ++proc) { |
|
|
|
if ((*proc)->pid == 0) { |
|
|
|
continue; // skip not running process
|
|
|
|