mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 18:43:54 -06:00
Minor fixes to ConhostConnection and VTPipeTerm (#1218)
* Cascadia/TerminalConnection: Close the output thread on exit. It seems that TerminateThread() is available in the code... * VtPipeTerm: Don't crash when closing the app. - Gracefully handle ReadFile returning false (usually because of ERROR_BROKEN_PIPE on exit). - Minor whitespace formatting. * Cascadia/TerminalConnection: Finish to implement the ConhostConnection::Close() 'TODO' block.
This commit is contained in:
parent
e20dfb8633
commit
d82eab44d0
@ -144,16 +144,17 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
return;
|
||||
}
|
||||
_closing = true;
|
||||
// TODO:
|
||||
// terminate the output thread
|
||||
// Close our handles
|
||||
// Close the Pseudoconsole
|
||||
// terminate our processes
|
||||
_connected = false;
|
||||
|
||||
// Terminate the output thread
|
||||
_outputThreadId = 0;
|
||||
TerminateThread(_hOutputThread, 0);
|
||||
|
||||
// Close our pipes and the pseudoconsole
|
||||
CloseHandle(_signalPipe);
|
||||
CloseHandle(_inPipe);
|
||||
CloseHandle(_outPipe);
|
||||
// What? CreateThread is in app partition but TerminateThread isn't?
|
||||
//TerminateThread(_hOutputThread, 0);
|
||||
|
||||
TerminateProcess(_piConhost.hProcess, 0);
|
||||
CloseHandle(_piConhost.hProcess);
|
||||
}
|
||||
|
||||
@ -345,8 +345,12 @@ DWORD VtConsole::_OutputThread()
|
||||
bool fSuccess = false;
|
||||
|
||||
fSuccess = !!ReadFile(this->outPipe(), buffer, ARRAYSIZE(buffer), &dwRead, nullptr);
|
||||
if (!fSuccess)
|
||||
{
|
||||
HRESULT hr = GetLastError();
|
||||
exit(hr);
|
||||
}
|
||||
|
||||
THROW_LAST_ERROR_IF(!fSuccess);
|
||||
if (this->_active)
|
||||
{
|
||||
_pfnReadCallback(buffer, dwRead);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user