connection: start up the output thread _only after_ all the pipes are up

Fixes #2527
This commit is contained in:
Dustin Howett 2019-08-23 17:58:15 -07:00
parent 5694606aea
commit 7bda725d18

View file

@ -81,17 +81,6 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
extraEnvVars.emplace(L"WT_SESSION", pwszGuid);
}
// Create our own output handling thread
// Each connection needs to make sure to drain the output from its backing host.
_hOutputThread.reset(CreateThread(nullptr,
0,
StaticOutputThreadProc,
this,
0,
nullptr));
THROW_LAST_ERROR_IF_NULL(_hOutputThread);
STARTUPINFO si = { 0 };
si.cb = sizeof(STARTUPINFOW);
@ -119,6 +108,18 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
si,
extraEnvVars));
// Create our own output handling thread
// This must be done after the pipes are populated.
// Each connection needs to make sure to drain the output from its backing host.
_hOutputThread.reset(CreateThread(nullptr,
0,
StaticOutputThreadProc,
this,
0,
nullptr));
THROW_LAST_ERROR_IF_NULL(_hOutputThread);
_connected = true;
}