Commit fb8530ed authored by Dāvis Mosāns's avatar Dāvis Mosāns Committed by Brad King
Browse files

ConsoleBuf: Make test more reliable

Change-Id: I3a726be174f9799e85d34243182e80cb35c655b5
parent fd9e86e8
......@@ -479,14 +479,14 @@ static int testConsole()
securityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
securityAttributes.bInheritHandle = TRUE;
securityAttributes.lpSecurityDescriptor = NULL;
hIn = CreateFileW(L"CONIN$", GENERIC_READ | GENERIC_WRITE, 0,
hIn = CreateFileW(L"CONIN$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
&securityAttributes, OPEN_EXISTING, 0, NULL);
hOut = CreateFileW(L"CONOUT$", GENERIC_READ | GENERIC_WRITE, 0,
if (hIn == INVALID_HANDLE_VALUE) {
DWORD lastError = GetLastError();
std::cerr << "CreateFile(CONIN$)" << std::endl;
displayError(lastError);
}
hOut = CreateFileW(L"CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
&securityAttributes, OPEN_EXISTING, 0, NULL);
if (hOut == INVALID_HANDLE_VALUE) {
DWORD lastError = GetLastError();
......@@ -555,6 +555,8 @@ static int testConsole()
}
writeInputKeyEvent(&inputBuffer[i*2], VK_RETURN);
DWORD eventsWritten = 0;
// We need to wait a bit before writing to console so child process have started waiting for input on stdin.
Sleep(300);
if (!WriteConsoleInputW(hIn, inputBuffer, sizeof(inputBuffer) /
sizeof(inputBuffer[0]),
&eventsWritten) || eventsWritten == 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment