Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: comment out invalid API call #669

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions src/win/conpty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ static Napi::Value PtyStartProcess(const Napi::CallbackInfo& info) {
if (SUCCEEDED(hr)) {
// We were able to instantiate a conpty
const int ptyId = InterlockedIncrement(&ptyCounter);
marshal.Set("pty", Napi::Number::New(env, ptyId));
marshal.Set("pty", Napi::Number::New(env, ptyId));
ptyHandles.insert(ptyHandles.end(), new pty_baton(ptyId, hIn, hOut, hpc));
} else {
throw Napi::Error::New(env, "Cannot launch conpty");
Expand Down Expand Up @@ -429,22 +429,22 @@ static Napi::Value PtyClear(const Napi::CallbackInfo& info) {
throw Napi::Error::New(env, "Usage: pty.clear(id)");
}

int id = info[0].As<Napi::Number>().Int32Value();

const pty_baton* handle = get_pty_baton(id);

if (handle != nullptr) {
HANDLE hLibrary = LoadLibraryExW(L"kernel32.dll", 0, 0);
bool fLoadedDll = hLibrary != nullptr;
if (fLoadedDll)
{
PFNCLEARPSEUDOCONSOLE const pfnClearPseudoConsole = (PFNCLEARPSEUDOCONSOLE)GetProcAddress((HMODULE)hLibrary, "ClearPseudoConsole");
if (pfnClearPseudoConsole)
{
pfnClearPseudoConsole(handle->hpc);
}
}
}
// int id = info[0].As<Napi::Number>().Int32Value();

// const pty_baton* handle = get_pty_baton(id);

// if (handle != nullptr) {
// HANDLE hLibrary = LoadLibraryExW(L"kernel32.dll", 0, 0);
// bool fLoadedDll = hLibrary != nullptr;
// if (fLoadedDll)
// {
// PFNCLEARPSEUDOCONSOLE const pfnClearPseudoConsole = (PFNCLEARPSEUDOCONSOLE)GetProcAddress((HMODULE)hLibrary, "ClearPseudoConsole");
// if (pfnClearPseudoConsole)
// {
// pfnClearPseudoConsole(handle->hpc);
// }
// }
// }

return env.Undefined();
}
Expand Down
Loading