-
-
Save dmerejkowsky/4e1ebd89a71f64961681 to your computer and use it in GitHub Desktop.
jenkins strange return code on Windows for CreateProcess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From the command line: | |
c:\pouet.exe | |
segfault | |
Exit code: 0xc0000005 | |
# From a jenkins slave connected as a Windows service: | |
c:\Users\xxxx\jenkins\workspace\pouet>C:\pouet.exe | |
segfault | |
Exit code: 0xff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <iostream> | |
int main() | |
{ | |
STARTUPINFO si; | |
PROCESS_INFORMATION pi; | |
ZeroMemory(&si, sizeof(si)); | |
si.cb = sizeof(si); | |
ZeroMemory(&pi, sizeof(pi)); | |
int rc = CreateProcess(NULL, | |
"C:\\segfault.exe", | |
NULL, | |
NULL, | |
FALSE, | |
0, | |
NULL, | |
NULL, | |
&si, | |
&pi | |
); | |
if( rc == FALSE) { | |
std::cerr << GetLastError() << std::endl; | |
return 1; | |
} | |
WaitForSingleObject(pi.hProcess, INFINITE); | |
DWORD exitCode; | |
rc = GetExitCodeProcess(pi.hProcess, &exitCode); | |
if (rc == FALSE) { | |
std::cerr << "Failed to get exit code: " << GetLastError() << std::endl; | |
return 1; | |
} | |
CloseHandle(pi.hProcess); | |
CloseHandle(pi.hThread); | |
std::cout << "Exit code: 0x" << std::hex << exitCode << std::endl; | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int main() | |
{ | |
std::cout << "segfault" << std::endl; | |
int* p = 0; | |
*p = 42; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382%28v=vs.85%29.aspx
ERROR_EA_LIST_INCONSISTENT ?
Your args of CreateProcess are problematic maybe ?
You can check qi::os::spawnvp for a reliable way to start a process.