win32 fixes to pass the ccache test-suite

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10987 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-12-19 21:41:05 +00:00
commit ab29ac767a
7 changed files with 95 additions and 28 deletions

View file

@ -136,10 +136,40 @@ static void failed(void)
putenv("CCACHE_OUTFILES");
}
#ifndef _WIN32
execv(orig_args->argv[0], orig_args->argv);
cc_log("execv returned (%s)!\n", strerror(errno));
perror(orig_args->argv[0]);
exit(1);
#else
/* execv on Windows causes the 'non-regular' testcase to fail, so use Win32 API instead */
{
PROCESS_INFORMATION pinfo;
STARTUPINFO sinfo;
BOOL ret;
DWORD exitcode;
char *args;
ZeroMemory(&pinfo, sizeof(PROCESS_INFORMATION));
ZeroMemory(&sinfo, sizeof(STARTUPINFO));
sinfo.cb = sizeof(STARTUPINFO);
args = argvtos(orig_args->argv);
ret = CreateProcessA(orig_args->argv[0], args, NULL, NULL, TRUE, 0, NULL, NULL,
&sinfo, &pinfo);
if (!ret) {
exitcode = 1;
cc_log("CreateProcessA failed starting %s\n", orig_args->argv[0]);
perror_win32(orig_args->argv[0]);
} else {
WaitForSingleObject(pinfo.hProcess, INFINITE);
GetExitCodeProcess(pinfo.hProcess, &exitcode);
CloseHandle(pinfo.hProcess);
CloseHandle(pinfo.hThread);
}
free(args);
exit(exitcode);
}
#endif
}