23 |
#include "variable.h" |
#include "variable.h" |
24 |
#include "job.h" |
#include "job.h" |
25 |
#include "commands.h" |
#include "commands.h" |
26 |
|
#ifdef WINDOWS32 |
27 |
|
#include <windows.h> |
28 |
|
#include "w32err.h" |
29 |
|
#endif |
30 |
|
|
31 |
#if VMS |
#if VMS |
32 |
# define FILE_LIST_SEPARATOR ',' |
# define FILE_LIST_SEPARATOR ',' |
424 |
|
|
425 |
exit (10); |
exit (10); |
426 |
#else /* not Amiga */ |
#else /* not Amiga */ |
427 |
|
#ifdef WINDOWS32 |
428 |
|
extern HANDLE main_thread; |
429 |
|
|
430 |
|
/* Windows creates a sperate thread for handling Ctrl+C, so we need |
431 |
|
to suspend the main thread, or else we will have race conditions |
432 |
|
when both threads call reap_children. */ |
433 |
|
if (main_thread) |
434 |
|
{ |
435 |
|
DWORD susp_count = SuspendThread (main_thread); |
436 |
|
|
437 |
|
if (susp_count != 0) |
438 |
|
fprintf (stderr, "SuspendThread: suspend count = %ld\n", susp_count); |
439 |
|
else if (susp_count == (DWORD)-1) |
440 |
|
{ |
441 |
|
DWORD ierr = GetLastError (); |
442 |
|
|
443 |
|
fprintf (stderr, "SuspendThread: error %ld: %s\n", |
444 |
|
ierr, map_windows32_error_to_string (ierr)); |
445 |
|
} |
446 |
|
} |
447 |
|
#endif |
448 |
handling_fatal_signal = 1; |
handling_fatal_signal = 1; |
449 |
|
|
450 |
/* Set the handling for this signal to the default. |
/* Set the handling for this signal to the default. |
507 |
#endif |
#endif |
508 |
|
|
509 |
#ifdef WINDOWS32 |
#ifdef WINDOWS32 |
510 |
/* Cannot call W32_kill with a pid (it needs a handle) */ |
if (main_thread) |
511 |
exit (EXIT_FAILURE); |
CloseHandle (main_thread); |
512 |
|
/* Cannot call W32_kill with a pid (it needs a handle). The exit |
513 |
|
status of 130 emulates what happens in Bash. */ |
514 |
|
exit (130); |
515 |
#else |
#else |
516 |
/* Signal the same code; this time it will really be fatal. The signal |
/* Signal the same code; this time it will really be fatal. The signal |
517 |
will be unblocked when we return and arrive then to kill us. */ |
will be unblocked when we return and arrive then to kill us. */ |