Skip to content

Commit

Permalink
connection: start up the output thread _only after_ all the pipes are…
Browse files Browse the repository at this point in the history
… up (#2528)

Fixes #2527
  • Loading branch information
DHowett authored Aug 26, 2019
1 parent 02d8df8 commit ebcf812
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/cascadia/TerminalConnection/ConhostConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit ebcf812

Please sign in to comment.