[~100% IMPACT] When you close a powershell tab, powershell *crashes* #1773

Closed
opened 2026-01-30 22:36:06 +00:00 by claunia · 3 comments
Owner

Originally created by @DHowett-MSFT on GitHub (Jun 20, 2019).

Powershell doesn't like its conhost being terminated, so it crashes.
The job object change made it more likely that we terminate its conhost without allowing it to exit normally. Yeah.

Originally created by @DHowett-MSFT on GitHub (Jun 20, 2019). Powershell doesn't like its conhost being terminated, so it crashes. The job object change made it more likely that we terminate its conhost without allowing it to exit normally. Yeah.
Author
Owner

@carlos-zamora commented on GitHub (Jun 20, 2019):

Performed a git bisect. Issue caused by PR #970.

ConhostConnection.cpp's ConhostConnection::Close() after line 165:

if (!_closing.exchange(true))
{
    _hJob.reset(); // This will terminate the process _piConhost is holding.
    // POWERSHELL CRASHES AT THIS MOMENT
    _piConhost.reset();

    _inPipe.reset();
    _outPipe.reset();
    _signalPipe.reset();

    WaitForSingleObject(_hOutputThread.get(), INFINITE);
    _hOutputThread.reset();
}
@carlos-zamora commented on GitHub (Jun 20, 2019): Performed a `git bisect`. Issue caused by PR #970. ConhostConnection.cpp's `ConhostConnection::Close()` after line 165: ```C++ if (!_closing.exchange(true)) { _hJob.reset(); // This will terminate the process _piConhost is holding. // POWERSHELL CRASHES AT THIS MOMENT _piConhost.reset(); _inPipe.reset(); _outPipe.reset(); _signalPipe.reset(); WaitForSingleObject(_hOutputThread.get(), INFINITE); _hOutputThread.reset(); } ```
Author
Owner

@DHowett-MSFT commented on GitHub (Jun 20, 2019):

Yep. Powershell doesn’t like its console host being terminated without it. I’m working on a fix for process rundown.

@DHowett-MSFT commented on GitHub (Jun 20, 2019): Yep. Powershell doesn’t like its console host being terminated without it. I’m working on a fix for process rundown.
Author
Owner

@DHowett-MSFT commented on GitHub (Jun 20, 2019):

Of note: CMD doesn’t care. Technically this is a powershell issue. We should still not break existing workflows :)

@DHowett-MSFT commented on GitHub (Jun 20, 2019): Of note: CMD doesn’t care. Technically this is a powershell issue. We should still not break existing workflows :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#1773