mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-11-19 21:29:58 +01:00
Fixes to hang on TTY child process exit
This commit is contained in:
parent
08cda06aa2
commit
46a6cc9c7c
@ -1116,9 +1116,13 @@ int start_with_pty(int ac, wchar_t **av) {
|
||||
childProcessId = pi.dwProcessId;
|
||||
|
||||
FreeConsole();
|
||||
Sleep(20);
|
||||
while (!AttachConsole(pi.dwProcessId))
|
||||
{
|
||||
Sleep(1000);
|
||||
DWORD exit_code;
|
||||
if (GetExitCodeProcess(pi.hProcess, &exit_code) && exit_code != STILL_ACTIVE)
|
||||
break;
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
/* monitor child exist */
|
||||
|
||||
@ -567,7 +567,7 @@ int do_exec_windows(Session *s, const char *command, int pty) {
|
||||
free(tmp);
|
||||
|
||||
if (s->display)
|
||||
SetEnvironmentVariableW(L"DISPLAY", s->display);
|
||||
SetEnvironmentVariableA("DISPLAY", s->display);
|
||||
|
||||
|
||||
//_wchdir(pw_dir_w);
|
||||
@ -674,8 +674,12 @@ int do_exec_windows(Session *s, const char *command, int pty) {
|
||||
FreeConsole();
|
||||
if (!debug_flag)
|
||||
ImpersonateLoggedOnUser(hToken);
|
||||
Sleep(20);
|
||||
while (AttachConsole(pi.dwProcessId) == FALSE) {
|
||||
Sleep(200);
|
||||
DWORD exit_code;
|
||||
if (GetExitCodeProcess(pi.hProcess, &exit_code) && exit_code != STILL_ACTIVE)
|
||||
break;
|
||||
Sleep(100);
|
||||
}
|
||||
if (!debug_flag)
|
||||
RevertToSelf();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user