fix SpawnedProcess ERROR_BAD_LENGTH

Summary: This fixes the `The program issued a command but the command length is incorrect` error we have been seeing in EdenFS Windows.

Reviewed By: wez

Differential Revision: D23589264

fbshipit-source-id: 72478a653ff07fca81c163bab12c0fd33f6a0a67
This commit is contained in:
Zeyi (Rice) Fan 2020-09-08 18:23:49 -07:00 committed by Facebook GitHub Bot
parent a6a73ec6b6
commit 01315a9bbc

View File

@ -562,6 +562,19 @@ SpawnedProcess::SpawnedProcess(
handles.push_back(handle);
}
if (!startupInfo.StartupInfo.hStdInput) {
startupInfo.StartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
handles.push_back(startupInfo.StartupInfo.hStdInput);
}
if (!startupInfo.StartupInfo.hStdOutput) {
startupInfo.StartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
handles.push_back(startupInfo.StartupInfo.hStdOutput);
}
if (!startupInfo.StartupInfo.hStdError) {
startupInfo.StartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
handles.push_back(startupInfo.StartupInfo.hStdError);
}
SIZE_T size;
InitializeProcThreadAttributeList(nullptr, 1, 0, &size);