Skip to content

Instantly share code, notes, and snippets.

@dmerejkowsky
Last active April 20, 2016 14:28
Show Gist options
  • Save dmerejkowsky/4e1ebd89a71f64961681 to your computer and use it in GitHub Desktop.
Save dmerejkowsky/4e1ebd89a71f64961681 to your computer and use it in GitHub Desktop.
jenkins strange return code on Windows for CreateProcess
# 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
#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;
}
#include <iostream>
int main()
{
std::cout << "segfault" << std::endl;
int* p = 0;
*p = 42;
}
@victorpaleologue
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment