diff options
author | Paul Smith <psmith@gnu.org> | 2005-08-08 05:08:00 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2005-08-08 05:08:00 +0000 |
commit | b237dff7753f444c4e0e8ea6bb1929243e45b310 (patch) | |
tree | 8ccb5752696b899aee3a1b7cce24936d698a835c /w32/subproc/sub_proc.c | |
parent | a53903e4c32f47ce3e20edd9114f4fabd028d13c (diff) | |
download | gunmake-b237dff7753f444c4e0e8ea6bb1929243e45b310.tar.gz |
- Fixed a bug reported by Michael Matz regarding handling of parallel
jobs after a failed job.
- Enhancements to WINDOWS32 code from Eli Zaretskii.
- Add Microsoft Project files from J. Grant.
Diffstat (limited to 'w32/subproc/sub_proc.c')
-rw-r--r-- | w32/subproc/sub_proc.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/w32/subproc/sub_proc.c b/w32/subproc/sub_proc.c index 6e36e37..ae1a354 100644 --- a/w32/subproc/sub_proc.c +++ b/w32/subproc/sub_proc.c @@ -1,6 +1,7 @@ #include <stdlib.h> #include <stdio.h> #include <process.h> /* for msvc _beginthreadex, _endthreadex */ +#include <signal.h> #include <windows.h> #include "sub_proc.h" @@ -522,7 +523,8 @@ process_begin( pproc->last_err = GetLastError(); pproc->lerrno = E_FORK; - fprintf(stderr, "process_begin: CreateProcess(%s, %s, ...) failed.\n", exec_path, command_line); + fprintf(stderr, "process_begin: CreateProcess(%s, %s, ...) failed.\n", + exec_path ? exec_path : "NULL", command_line); if (envblk) free(envblk); free( command_line ); return(-1); @@ -762,7 +764,13 @@ process_pipe_io( } else if (ready_hand == childhand) { - GetExitCodeResult = GetExitCodeProcess(childhand, (DWORD*)&pproc->exit_code); + DWORD ierr; + GetExitCodeResult = GetExitCodeProcess(childhand, &ierr); + if (ierr == CONTROL_C_EXIT) { + pproc->signal = SIGINT; + } else { + pproc->exit_code = ierr; + } if (GetExitCodeResult == FALSE) { pproc->last_err = GetLastError(); pproc->lerrno = E_SCALL; @@ -811,6 +819,7 @@ process_file_io( HANDLE childhand; DWORD wait_return; BOOL GetExitCodeResult; + DWORD ierr; if (proc == NULL) pproc = process_wait_for_any_private(); @@ -854,7 +863,12 @@ process_file_io( goto done2; } - GetExitCodeResult = GetExitCodeProcess(childhand, (DWORD*)&pproc->exit_code); + GetExitCodeResult = GetExitCodeProcess(childhand, &ierr); + if (ierr == CONTROL_C_EXIT) { + pproc->signal = SIGINT; + } else { + pproc->exit_code = ierr; + } if (GetExitCodeResult == FALSE) { pproc->last_err = GetLastError(); pproc->lerrno = E_SCALL; @@ -1163,7 +1177,7 @@ process_easy( TRUE, DUPLICATE_SAME_ACCESS) == FALSE) { fprintf(stderr, - "process_easy: DuplicateHandle(In) failed (e=%d)\n", + "process_easy: DuplicateHandle(In) failed (e=%ld)\n", GetLastError()); return INVALID_HANDLE_VALUE; } @@ -1175,7 +1189,7 @@ process_easy( TRUE, DUPLICATE_SAME_ACCESS) == FALSE) { fprintf(stderr, - "process_easy: DuplicateHandle(Out) failed (e=%d)\n", + "process_easy: DuplicateHandle(Out) failed (e=%ld)\n", GetLastError()); return INVALID_HANDLE_VALUE; } @@ -1187,7 +1201,7 @@ process_easy( TRUE, DUPLICATE_SAME_ACCESS) == FALSE) { fprintf(stderr, - "process_easy: DuplicateHandle(Err) failed (e=%d)\n", + "process_easy: DuplicateHandle(Err) failed (e=%ld)\n", GetLastError()); return INVALID_HANDLE_VALUE; } |