Browse Source

update: optimize log output

dev
Dnomd343 2 years ago
parent
commit
ec7ecb317c
  1. 5
      src/utils/process.c

5
src/utils/process.c

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

Loading…
Cancel
Save