in src/win/winpty.cc [274:297]
static NAN_METHOD(PtyKill) {
Nan::HandleScope scope;
if (info.Length() != 2 ||
!info[0]->IsNumber() ||
!info[1]->IsNumber()) {
Nan::ThrowError("Usage: pty.kill(pid, innerPidHandle)");
return;
}
int handle = info[0]->Int32Value(Nan::GetCurrentContext()).FromJust();
HANDLE innerPidHandle = (HANDLE)info[1]->Int32Value(Nan::GetCurrentContext()).FromJust();
winpty_t *pc = get_pipe_handle(handle);
if (pc == nullptr) {
Nan::ThrowError("Pty seems to have been killed already");
return;
}
assert(remove_pipe_handle(handle));
CloseHandle(innerPidHandle);
return info.GetReturnValue().SetUndefined();
}