mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
tweaks
This commit is contained in:
parent
bb6fd11fab
commit
031feceb39
@ -56,12 +56,9 @@ exec_process() {
|
|||||||
execvp(params[0], params);
|
execvp(params[0], params);
|
||||||
fprintf(stderr, "Cannot exec %s: %s\n", params[0], strerror(errno));
|
fprintf(stderr, "Cannot exec %s: %s\n", params[0], strerror(errno));
|
||||||
|
|
||||||
/* Kill ourselves instead of exiting, to indicate the watching
|
/* Exit with a status of 0, to indicate to the parent process that
|
||||||
process should stop. */
|
we should stop. */
|
||||||
kill(getpid(), SIGTERM);
|
exit(0);
|
||||||
|
|
||||||
/* Shouldn't get here. */
|
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -103,9 +100,10 @@ spawn_process() {
|
|||||||
return (signal != SIGTERM && signal != SIGKILL);
|
return (signal != SIGTERM && signal != SIGKILL);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "\nprocess exited with error code %d.\n\n", WEXITSTATUS(status));
|
int exit_status = WEXITSTATUS(status);
|
||||||
/* Normal exit is always a reason to respawn. */
|
fprintf(stderr, "\nprocess exited with status %d.\n\n", WEXITSTATUS(status));
|
||||||
return 1;
|
/* Normal exit is a reason to respawn if the status indicates failure. */
|
||||||
|
return (exit_status != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +203,7 @@ double_fork() {
|
|||||||
if (WIFSIGNALED(status)) {
|
if (WIFSIGNALED(status)) {
|
||||||
fprintf(stderr, "child caught signal %d unexpectedly.\n", WTERMSIG(status));
|
fprintf(stderr, "child caught signal %d unexpectedly.\n", WTERMSIG(status));
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "child exited with error code %d.\n", WEXITSTATUS(status));
|
fprintf(stderr, "child exited with status %d.\n", WEXITSTATUS(status));
|
||||||
}
|
}
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -224,7 +222,11 @@ help() {
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"This program is used to run a program as a background task and\n"
|
"This program is used to run a program as a background task and\n"
|
||||||
"automatically restart it should it terminate for any reason other\n"
|
"automatically restart it should it terminate for any reason other\n"
|
||||||
"than explicit user kill.\n\n"
|
"than normal exit or explicit user kill.\n\n"
|
||||||
|
|
||||||
|
"If the program exits with a status of 0, indicating successful\n"
|
||||||
|
"completion, it is not restarted.\n\n"
|
||||||
|
|
||||||
"If the program is terminated via a TERM or KILL signal (e.g. via\n"
|
"If the program is terminated via a TERM or KILL signal (e.g. via\n"
|
||||||
"kill [pid] or kill -i [pid]), it is assumed the user meant for the\n"
|
"kill [pid] or kill -i [pid]), it is assumed the user meant for the\n"
|
||||||
"process to stop, and it is not restarted.\n\n");
|
"process to stop, and it is not restarted.\n\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user