- Timestamp:
- Mar 1, 2016, 11:34:48 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20160226/src/opihi/cmd.basic/shell.c
r33662 r39419 51 51 // wait for process to finish or timeout 52 52 // loop forever if desired, but catch C-C and stop the process on interrupt 53 interrupt = FALSE;53 struct sigaction *old_sigaction = SetInterrupt(); 54 54 while (!interrupt) { 55 55 result = waitpid (pid, &wait_status, WNOHANG); … … 59 59 case ECHILD: 60 60 gprint (GP_ERR, "unknown PID, not a child process: %d\n", pid); 61 ClearInterrupt (old_sigaction); 61 62 return (FALSE); 62 63 default: … … 72 73 if (DTIME(now, start) > timeout) { 73 74 gprint (GP_ERR, "timeout on %s (pid %d)\n", argv[1], pid); 75 ClearInterrupt (old_sigaction); 74 76 return (FALSE); 75 77 } … … 83 85 } 84 86 if (WIFEXITED(wait_status)) { 87 ClearInterrupt (old_sigaction); 85 88 exit_status = WEXITSTATUS(wait_status); 86 89 if (exit_status) { … … 91 94 } 92 95 if (WIFSIGNALED(wait_status)) { 96 ClearInterrupt (old_sigaction); 93 97 gprint (GP_ERR, "job %d exited on signal %d\n", pid, WTERMSIG(wait_status)); 94 98 return (FALSE); … … 100 104 } 101 105 } 106 ClearInterrupt (old_sigaction); 102 107 gprint (GP_ERR, "caught interrupt, killing %s (%d)\n", argv[1], pid); 103 108
Note:
See TracChangeset
for help on using the changeset viewer.
