diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2004-06-23 20:34:38 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2004-06-23 20:34:38 (GMT) |
commit | 2705b1bf736e5f98b0862e831fe9ab2799d1d0ee (patch) | |
tree | 4e3cc1d74fbae4c2f34df019f812f00a11b21b2a /Source/cmWin32ProcessExecution.cxx | |
parent | dc4a6f63b0452968dc564be46909ed228bbc141c (diff) | |
download | CMake-2705b1bf736e5f98b0862e831fe9ab2799d1d0ee.zip CMake-2705b1bf736e5f98b0862e831fe9ab2799d1d0ee.tar.gz CMake-2705b1bf736e5f98b0862e831fe9ab2799d1d0ee.tar.bz2 |
BUG: fix spaces in path on mingw, and change EXEC_PROGRAM to return false when it does not run, also do not convert the directory to an output path for EXEC_PROGRAM as this is done by the process execution, and doing it twice may cause trouble on some shells.
Diffstat (limited to 'Source/cmWin32ProcessExecution.cxx')
-rw-r--r-- | Source/cmWin32ProcessExecution.cxx | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/Source/cmWin32ProcessExecution.cxx b/Source/cmWin32ProcessExecution.cxx index ba736db..d06a33c 100644 --- a/Source/cmWin32ProcessExecution.cxx +++ b/Source/cmWin32ProcessExecution.cxx @@ -441,9 +441,37 @@ static BOOL RealPopenCreateProcess(const char *cmdstring, free(s1); return TRUE; } - output += "CreateProcessError "; + + LPVOID lpMsgBuf; + + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &lpMsgBuf, + 0, + NULL + ); + + // Free the buffer. + + char* str = 0; + str = strcpy(new char[strlen((char*)lpMsgBuf)+1], (char*)lpMsgBuf); + LocalFree( lpMsgBuf ); + + output += "CreateProcessError: "; + output += str; + output += "\n"; + output += "for command: "; output += s2; + if(path) + { + output += "\nin dir: "; + output += path; + } output += "\n"; + delete [] str; free(s2); free(s1); return FALSE; |