mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-03-03 13:35:46 +08:00
setup_pseudoconsole(): handle missing/incorrect helper gracefully
When `cygwin-console-helper.exe` is either missing, or corresponds to a different Cygwin runtime, we currently wait forever while setting up access to the pseudo console, even long after the process is gone that was supposed to signal that it set up access to the pseudo console. Let's handle that more gracefully: if the process exited without signaling, we cannot use the pseudo console. In that case, let's just fall back to not using it. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
parent
453b6d17bf
commit
717db9fd1c
@ -3496,7 +3496,23 @@ fhandler_pty_master::setup_pseudoconsole ()
|
||||
TRUE, EXTENDED_STARTUPINFO_PRESENT,
|
||||
NULL, NULL, &si_helper.StartupInfo, &pi_helper))
|
||||
goto cleanup_event_and_pipes;
|
||||
WaitForSingleObject (hello, INFINITE);
|
||||
for (;;)
|
||||
{
|
||||
DWORD wait_result = WaitForSingleObject (hello, 500);
|
||||
if (wait_result == WAIT_OBJECT_0)
|
||||
break;
|
||||
if (wait_result != WAIT_TIMEOUT)
|
||||
goto cleanup_helper_process;
|
||||
DWORD exit_code;
|
||||
if (!GetExitCodeProcess(pi_helper.hProcess, &exit_code))
|
||||
goto cleanup_helper_process;
|
||||
if (exit_code == STILL_ACTIVE)
|
||||
continue;
|
||||
if (exit_code != 0 ||
|
||||
WaitForSingleObject (hello, 500) != WAIT_OBJECT_0)
|
||||
goto cleanup_helper_process;
|
||||
break;
|
||||
}
|
||||
CloseHandle (hello);
|
||||
CloseHandle (pi_helper.hThread);
|
||||
/* Retrieve pseudo console handles */
|
||||
|
Loading…
x
Reference in New Issue
Block a user