Skip to content

Commit

Permalink
Merge pull request #510 from microsoft/rzhao271/close-iohandles
Browse files Browse the repository at this point in the history
Disconnect IO handles during PtyKill
  • Loading branch information
Tyriar authored Nov 12, 2021
2 parents b7c76f2 + ba424e1 commit 256c59c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/win/conpty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ static NAN_METHOD(PtyConnect) {
auto envV = vectorFromString(env);
LPWSTR envArg = envV.empty() ? nullptr : envV.data();

BOOL success = ConnectNamedPipe(handle->hIn, nullptr);
success = ConnectNamedPipe(handle->hOut, nullptr);
ConnectNamedPipe(handle->hIn, nullptr);
ConnectNamedPipe(handle->hOut, nullptr);

// Attach the pseudoconsole to the client application we're creating
STARTUPINFOEXW siEx{0};
Expand Down Expand Up @@ -442,6 +442,10 @@ static NAN_METHOD(PtyKill) {
}
}

DisconnectNamedPipe(handle->hIn);
DisconnectNamedPipe(handle->hOut);
CloseHandle(handle->hIn);
CloseHandle(handle->hOut);
CloseHandle(handle->hShell);
}

Expand Down

0 comments on commit 256c59c

Please sign in to comment.