Check if app was killed by a signal
@@ -1111,14 +1111,16 @@ Sync_Exec_Cmd(ClientData cdata, Tcl_Interp *interp,
}
rc = execvp(cmd, cmd_argv);
- TCL_CONDITION(rc != -1, "Error executing command %s: %s", cmd,
+ TCL_CONDITION(rc != -1, "Error exec()ing command %s: %s", cmd,
strerror(errno));
}
int status;
- waitpid(child, &status, 0);
+ rc = waitpid(child, &status, 0);
+ assert(rc > 0);
+ if (WIFEXITED(status))
+ {
int exitcode = WEXITSTATUS(status);
-
if (exitcode != 0)
{
if (tcl_version > 8.5)
@@ -1138,6 +1140,17 @@ Sync_Exec_Cmd(ClientData cdata, Tcl_Interp *interp,
return TCL_ERROR;
}
}
+ }
+ else if (WIFSIGNALED(status))
+ {
+ printf("child killed by signal!\n");
+ exit(1);
+ }
+ else
+ {
+ printf("WHAT HAPPENED?\n");
+ exit(1);
+ }
return TCL_OK;
}
