From b237dff7753f444c4e0e8ea6bb1929243e45b310 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Mon, 8 Aug 2005 05:08:00 +0000 Subject: - 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. --- w32/subproc/build.bat | 7 +++++++ w32/subproc/sub_proc.c | 26 ++++++++++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) (limited to 'w32/subproc') diff --git a/w32/subproc/build.bat b/w32/subproc/build.bat index b68fc31..b057b3c 100644 --- a/w32/subproc/build.bat +++ b/w32/subproc/build.bat @@ -1,3 +1,4 @@ +@if "%1" == "gcc" GoTo GCCBuild if not exist .\WinDebug\nul mkdir .\WinDebug cl.exe /nologo /MT /W4 /GX /Z7 /YX /Od /I .. /I . /I ../include /D WIN32 /D WINDOWS32 /D _DEBUG /D _WINDOWS /FR.\WinDebug/ /Fp.\WinDebug/subproc.pch /Fo.\WinDebug/ /c misc.c cl.exe /nologo /MT /W4 /GX /Z7 /YX /Od /I .. /I . /I ../include /I ../.. /D WIN32 /D WINDOWS32 /D _DEBUG /D _WINDOWS /FR.\WinDebug/ /Fp.\WinDebug/subproc.pch /Fo.\WinDebug/ /c sub_proc.c @@ -8,3 +9,9 @@ cl.exe /nologo /MT /W4 /GX /YX /O2 /I ../include /D WIN32 /D WINDOWS32 /D NDEBUG cl.exe /nologo /MT /W4 /GX /YX /O2 /I ../include /I ../.. /D WIN32 /D WINDOWS32 /D NDEBUG /D _WINDOWS /FR.\WinRel/ /Fp.\WinRel/subproc.pch /Fo.\WinRel/ /c sub_proc.c cl.exe /nologo /MT /W4 /GX /YX /O2 /I ../include /D WIN32 /D WINDOWS32 /D NDEBUG /D _WINDOWS /FR.\WinRel/ /Fp.\WinRel/subproc.pch /Fo.\WinRel/ /c w32err.c lib.exe /NOLOGO /OUT:.\WinRel\subproc.lib .\WinRel/misc.obj .\WinRel/sub_proc.obj .\WinRel/w32err.obj +GoTo BuildEnd +:GCCBuild +gcc -mthreads -Wall -gstabs+ -ggdb3 -O2 -I.. -I. -I../include -I../.. -DWINDOWS32 -c misc.c -o ../../w32_misc.o +gcc -mthreads -Wall -gstabs+ -ggdb3 -O2 -I.. -I. -I../include -I../.. -DWINDOWS32 -c sub_proc.c -o ../../sub_proc.o +gcc -mthreads -Wall -gstabs+ -ggdb3 -O2 -I.. -I. -I../include -I../.. -DWINDOWS32 -c w32err.c -o ../../w32err.o +:BuildEnd 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 #include #include /* for msvc _beginthreadex, _endthreadex */ +#include #include #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; } -- cgit v1.2.3