mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-11-19 13:20:02 +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;
|
childProcessId = pi.dwProcessId;
|
||||||
|
|
||||||
FreeConsole();
|
FreeConsole();
|
||||||
|
Sleep(20);
|
||||||
while (!AttachConsole(pi.dwProcessId))
|
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 */
|
/* monitor child exist */
|
||||||
|
|||||||
@ -567,7 +567,7 @@ int do_exec_windows(Session *s, const char *command, int pty) {
|
|||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
if (s->display)
|
if (s->display)
|
||||||
SetEnvironmentVariableW(L"DISPLAY", s->display);
|
SetEnvironmentVariableA("DISPLAY", s->display);
|
||||||
|
|
||||||
|
|
||||||
//_wchdir(pw_dir_w);
|
//_wchdir(pw_dir_w);
|
||||||
@ -674,8 +674,12 @@ int do_exec_windows(Session *s, const char *command, int pty) {
|
|||||||
FreeConsole();
|
FreeConsole();
|
||||||
if (!debug_flag)
|
if (!debug_flag)
|
||||||
ImpersonateLoggedOnUser(hToken);
|
ImpersonateLoggedOnUser(hToken);
|
||||||
|
Sleep(20);
|
||||||
while (AttachConsole(pi.dwProcessId) == FALSE) {
|
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)
|
if (!debug_flag)
|
||||||
RevertToSelf();
|
RevertToSelf();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user