mirror of
https://github.com/perk11/runwhenidle.git
synced 2026-01-09 13:48:01 -05:00
Check if PID is running before starting to monitor
This commit is contained in:
4
main.c
4
main.c
@@ -178,6 +178,10 @@ int main(int argc, char *argv[]) {
|
||||
pid = run_shell_command(shell_command_to_run);
|
||||
} else {
|
||||
pid = external_pid;
|
||||
if (kill(pid, 0) == -1) {
|
||||
fprintf_error("PID %d is not running\n", pid);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
free(shell_command_to_run);
|
||||
struct timespec time_when_command_started;
|
||||
|
||||
Reference in New Issue
Block a user