File tree 1 file changed +19
-13
lines changed
1 file changed +19
-13
lines changed Original file line number Diff line number Diff line change @@ -219,19 +219,25 @@ int system_strnumcmp(M2_string s,M2_string t) {
219
219
}
220
220
221
221
int fix_status (int status ) {
222
- /* We can't handle status codes bigger than 127 if the shell intervenes. */
223
- return
224
- status == ERROR ? ERROR :
225
- WIFSIGNALED (status ) ? /* whether the process died due to a signal */
226
- WTERMSIG (status ) + (WCOREDUMP (status ) ? 128 : 0 ) : /* signal number n, plus 128 if core was dumped */
227
- WIFEXITED (status ) ? /* whether the process exited */
228
- (
229
- ((WEXITSTATUS (status ) & 0x80 ) != 0 ) ? /* whether /bin/sh indicates a signal in a command */
230
- (WEXITSTATUS (status ) & 0x7f ) : /* the signal number */
231
- (WEXITSTATUS (status ) << 8 ) /* status code times 256 */
232
- ) :
233
- -2 ; /* still running (or stopped) */
234
- }
222
+ /* We can't handle status codes bigger than 127 if the shell intervenes. */
223
+ if (status == ERROR )
224
+ return ERROR ;
225
+ else if (WIFSIGNALED (status )) { /* whether the process died due to a signal */
226
+ #ifdef WCOREDUMP
227
+ return WTERMSIG (status ) + (WCOREDUMP (status ) ? 128 : 0 ); /* signal number n, plus 128 if core was dumped */
228
+ #else
229
+ return WTERMSIG (status );
230
+ #endif
231
+ }
232
+ else if (WIFEXITED (status )) { /* whether the process exited */
233
+ if ((WEXITSTATUS (status ) & 0x80 ) != 0 ) /* whether /bin/sh indicates a signal in a command */
234
+ return WEXITSTATUS (status ) & 0x7f ; /* the signal number */
235
+ else
236
+ return WEXITSTATUS (status ) << 8 ; /* status code times 256 */
237
+ }
238
+ else
239
+ return -2 ; /* still running (or stopped) */
240
+ }
235
241
236
242
M2_arrayint system_waitNoHang (M2_arrayint pids )
237
243
{
You can’t perform that action at this time.
0 commit comments