mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
when CreateProcess fails, show the reason why
This commit is contained in:
parent
08eb8c26f2
commit
9a1d95efb4
@ -530,10 +530,22 @@ namespace mongo {
|
||||
ZeroMemory(&pi, sizeof(pi));
|
||||
|
||||
bool success = CreateProcess( NULL, args_tchar.get(), NULL, NULL, true, 0, NULL, NULL, &si, &pi) != 0;
|
||||
{
|
||||
if (!success) {
|
||||
LPSTR lpMsgBuf=0;
|
||||
DWORD dw = GetLastError();
|
||||
FormatMessageA(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL,
|
||||
dw,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPSTR)&lpMsgBuf,
|
||||
0, NULL );
|
||||
stringstream ss;
|
||||
ss << "couldn't start process " << argv_[0];
|
||||
ss << "couldn't start process " << argv_[0] << "; " << lpMsgBuf;
|
||||
uassert(14042, ss.str(), success);
|
||||
LocalFree(lpMsgBuf);
|
||||
}
|
||||
|
||||
CloseHandle(pi.hThread);
|
||||
|
Loading…
Reference in New Issue
Block a user