HANDLE h = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid);
if (h == NULL)
return;
- if (sig == 9)
- {
- TerminateProcess (h, 1);
- }
- else if (sig == SIGINT)
- GenerateConsoleCtrlEvent (CTRL_C_EVENT, pid);
- else if (sig == SIGBREAK)
- GenerateConsoleCtrlEvent (CTRL_BREAK_EVENT, pid);
- /* ??? The last two alternatives don't really work. SIGBREAK requires setting
- up process groups at start time which we don't do; treating SIGINT is just
- not possible apparently. So we really only support signal 9. Fortunately
- that's all we use in GNAT.Expect */
+
+ TerminateProcess (h, sig);
CloseHandle (h);
#elif defined (__vxworks)
{
int status = 0;
- waitpid (pid, &status, 0);
- status = WEXITSTATUS (status);
+ if (waitpid (pid, &status, 0) == -1) {
+ return -1;
+ }
+
+ if WIFEXITED (status) {
+ status = WEXITSTATUS (status);
+ } else if WIFSIGNALED (status) {
+ status = WTERMSIG (status);
+ } else if WIFSTOPPED (status) {
+ status = WSTOPSIG (status);
+ }
return status;
}