33 |
|
|
34 |
/* Default shell to use. */ |
/* Default shell to use. */ |
35 |
#ifdef WINDOWS32 |
#ifdef WINDOWS32 |
36 |
|
#include <windows.h> |
37 |
|
|
38 |
char *default_shell = "sh.exe"; |
char *default_shell = "sh.exe"; |
39 |
int no_default_sh_exe = 1; |
int no_default_sh_exe = 1; |
40 |
int batch_mode_shell = 1; |
int batch_mode_shell = 1; |
41 |
|
HANDLE main_thread; |
42 |
|
|
43 |
#elif defined (_AMIGA) |
#elif defined (_AMIGA) |
44 |
|
|
446 |
void |
void |
447 |
reap_children (int block, int err) |
reap_children (int block, int err) |
448 |
{ |
{ |
449 |
|
#ifndef WINDOWS32 |
450 |
WAIT_T status; |
WAIT_T status; |
451 |
/* Initially, assume we have some. */ |
/* Initially, assume we have some. */ |
452 |
int reap_more = 1; |
int reap_more = 1; |
453 |
|
#endif |
454 |
|
|
455 |
#ifdef WAIT_NOHANG |
#ifdef WAIT_NOHANG |
456 |
# define REAP_MORE reap_more |
# define REAP_MORE reap_more |
479 |
|
|
480 |
if (err && block) |
if (err && block) |
481 |
{ |
{ |
482 |
/* We might block for a while, so let the user know why. */ |
static int printed = 0; |
483 |
|
|
484 |
|
/* We might block for a while, so let the user know why. |
485 |
|
Only print this message once no matter how many jobs are left. */ |
486 |
fflush (stdout); |
fflush (stdout); |
487 |
error (NILF, _("*** Waiting for unfinished jobs....")); |
if (!printed) |
488 |
|
error (NILF, _("*** Waiting for unfinished jobs....")); |
489 |
|
printed = 1; |
490 |
} |
} |
491 |
|
|
492 |
/* We have one less dead child to reap. As noted in |
/* We have one less dead child to reap. As noted in |
617 |
#ifdef WINDOWS32 |
#ifdef WINDOWS32 |
618 |
{ |
{ |
619 |
HANDLE hPID; |
HANDLE hPID; |
620 |
int err; |
int werr; |
621 |
|
HANDLE hcTID, hcPID; |
622 |
exit_code = 0; |
exit_code = 0; |
623 |
exit_sig = 0; |
exit_sig = 0; |
624 |
coredump = 0; |
coredump = 0; |
625 |
|
|
626 |
|
/* Record the thread ID of the main process, so that we |
627 |
|
could suspend it in the signal handler. */ |
628 |
|
if (!main_thread) |
629 |
|
{ |
630 |
|
hcTID = GetCurrentThread (); |
631 |
|
hcPID = GetCurrentProcess (); |
632 |
|
if (!DuplicateHandle (hcPID, hcTID, hcPID, &main_thread, 0, |
633 |
|
FALSE, DUPLICATE_SAME_ACCESS)) |
634 |
|
{ |
635 |
|
DWORD e = GetLastError (); |
636 |
|
fprintf (stderr, |
637 |
|
"Determine main thread ID (Error %ld: %s)\n", |
638 |
|
e, map_windows32_error_to_string(e)); |
639 |
|
} |
640 |
|
else |
641 |
|
DB (DB_VERBOSE, ("Main thread handle = 0x%08lx\n", |
642 |
|
(unsigned long)main_thread)); |
643 |
|
} |
644 |
|
|
645 |
/* wait for anything to finish */ |
/* wait for anything to finish */ |
646 |
hPID = process_wait_for_any(); |
hPID = process_wait_for_any(); |
647 |
if (hPID) |
if (hPID) |
648 |
{ |
{ |
649 |
|
|
650 |
/* was an error found on this process? */ |
/* was an error found on this process? */ |
651 |
err = process_last_err(hPID); |
werr = process_last_err(hPID); |
652 |
|
|
653 |
/* get exit data */ |
/* get exit data */ |
654 |
exit_code = process_exit_code(hPID); |
exit_code = process_exit_code(hPID); |
655 |
|
|
656 |
if (err) |
if (werr) |
657 |
fprintf(stderr, "make (e=%d): %s", |
fprintf(stderr, "make (e=%d): %s", |
658 |
exit_code, map_windows32_error_to_string(exit_code)); |
exit_code, map_windows32_error_to_string(exit_code)); |
659 |
|
|
966 |
static void |
static void |
967 |
start_job_command (struct child *child) |
start_job_command (struct child *child) |
968 |
{ |
{ |
969 |
#ifndef _AMIGA |
#if !defined(_AMIGA) && !defined(WINDOWS32) |
970 |
static int bad_stdin = -1; |
static int bad_stdin = -1; |
971 |
#endif |
#endif |
972 |
register char *p; |
register char *p; |
1380 |
int i; |
int i; |
1381 |
unblock_sigs(); |
unblock_sigs(); |
1382 |
fprintf(stderr, |
fprintf(stderr, |
1383 |
_("process_easy() failed failed to launch process (e=%d)\n"), |
_("process_easy() failed failed to launch process (e=%ld)\n"), |
1384 |
process_last_err(hPID)); |
process_last_err(hPID)); |
1385 |
for (i = 0; argv[i]; i++) |
for (i = 0; argv[i]; i++) |
1386 |
fprintf(stderr, "%s ", argv[i]); |
fprintf(stderr, "%s ", argv[i]); |
1997 |
{ |
{ |
1998 |
int i; |
int i; |
1999 |
fprintf(stderr, |
fprintf(stderr, |
2000 |
_("process_easy() failed failed to launch process (e=%d)\n"), |
_("process_easy() failed failed to launch process (e=%ld)\n"), |
2001 |
process_last_err(hPID)); |
process_last_err(hPID)); |
2002 |
for (i = 0; argv[i]; i++) |
for (i = 0; argv[i]; i++) |
2003 |
fprintf(stderr, "%s ", argv[i]); |
fprintf(stderr, "%s ", argv[i]); |
2301 |
#ifdef WINDOWS32 |
#ifdef WINDOWS32 |
2302 |
int slow_flag = 0; |
int slow_flag = 0; |
2303 |
|
|
2304 |
if (no_default_sh_exe) { |
if (!unixy_shell) { |
2305 |
sh_cmds = sh_cmds_dos; |
sh_cmds = sh_cmds_dos; |
2306 |
sh_chars = sh_chars_dos; |
sh_chars = sh_chars_dos; |
2307 |
} else { |
} else { |
2478 |
else if (p[1] != '\0') |
else if (p[1] != '\0') |
2479 |
{ |
{ |
2480 |
#ifdef HAVE_DOS_PATHS |
#ifdef HAVE_DOS_PATHS |
2481 |
/* Only remove backslashes before characters special |
/* Only remove backslashes before characters special to Unixy |
2482 |
to Unixy shells. All other backslashes are copied |
shells. All other backslashes are copied verbatim, since |
2483 |
verbatim, since they are probably DOS-style |
they are probably DOS-style directory separators. This |
2484 |
directory separators. This still leaves a small |
still leaves a small window for problems, but at least it |
2485 |
window for problems, but at least it should work |
should work for the vast majority of naive users. */ |
|
for the vast majority of naive users. */ |
|
2486 |
|
|
2487 |
#ifdef __MSDOS__ |
#ifdef __MSDOS__ |
2488 |
/* A dot is only special as part of the "..." |
/* A dot is only special as part of the "..." |
2497 |
#endif |
#endif |
2498 |
if (p[1] != '\\' && p[1] != '\'' |
if (p[1] != '\\' && p[1] != '\'' |
2499 |
&& !isspace ((unsigned char)p[1]) |
&& !isspace ((unsigned char)p[1]) |
2500 |
&& (strchr (sh_chars_sh, p[1]) == 0)) |
&& strchr (sh_chars_sh, p[1]) == 0) |
2501 |
/* back up one notch, to copy the backslash */ |
/* back up one notch, to copy the backslash */ |
2502 |
--p; |
--p; |
2503 |
#endif /* HAVE_DOS_PATHS */ |
#endif /* HAVE_DOS_PATHS */ |