X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fghc-inplace.c;h=d7599ea2f86a1c6520477bd3540112f3bbe002cc;hp=78cffba229df1b9c9e0f8b7d59348cd623daf269;hb=6a05ec5ef5373f61b7f9f5bdc344483417fa801b;hpb=af2db474c2bb80e29924430e3c730bc217e55189 diff --git a/compiler/ghc-inplace.c b/compiler/ghc-inplace.c index 78cffba..d7599ea 100644 --- a/compiler/ghc-inplace.c +++ b/compiler/ghc-inplace.c @@ -31,15 +31,19 @@ int main(int argc, char **argv) { fprintf(stderr, "Malloc failed\n"); exit(1); } - args[0] = GHC_PATH; - args[1] = "-B" TOP_ABS; + args[0] = "GHC_PATH"; /* Gets replaced by sed */ + args[1] = "-BTOP_ABS"; /* Gets replaced by sed */ args[2] = "-fhardwire-lib-paths"; if ((argc >= 2) && (strcmp(argv[1], "-v") == 0)) { printf("Using %s %s %s\n", args[0], args[1], args[2]); + fflush(stdout); } memcpy(args + 3, argv + 1, sizeof(char *) * (argc - 1)); args[argc+2] = NULL; - return run(argv[0], GHC_PATH, argc + 2, args); + return run(argv[0], + "GHC_PATH", /* Gets replaced by sed */ + argc + 2, + args); } #ifndef WINDOWS @@ -51,6 +55,7 @@ int run(char *this, char *program, int argc, char** argv) { int run(char *this, char *program, int argc, char** argv) { TCHAR programShort[MAX_PATH+1]; DWORD dwSize; + DWORD dwExitCode; int i; char* new_cmdline; char *ptr; @@ -131,7 +136,12 @@ int run(char *this, char *program, int argc, char** argv) { switch (WaitForSingleObject(pi.hProcess, INFINITE) ) { case WAIT_OBJECT_0: - return 0; + if (GetExitCodeProcess(pi.hProcess, &dwExitCode)) { + return dwExitCode; + } + else { + return 1; + } case WAIT_ABANDONED: case WAIT_FAILED: /* in the event we get any hard errors, bring the child