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

Windows OS conhost problem #5

Open
movade005 opened this issue Mar 9, 2023 · 0 comments
Open

Windows OS conhost problem #5

movade005 opened this issue Mar 9, 2023 · 0 comments

Comments

@movade005
Copy link

I think you should use "ClosePseudoConsole" in "flutter_pty_win.c" , in function start_wait_exit_thread , here is the code:
static DWORD WINAPI wait_exit_thread(LPVOID arg)
{
WaitExitOptions *options = (WaitExitOptions *)arg;

DWORD exit_code = 0;

WaitForSingleObject(options->pid, INFINITE);

GetExitCodeProcess(options->pid, &exit_code);

CloseHandle(options->pid);
CloseHandle(options->hMutex);
ClosePseudoConsole(options->hpty);      // To close the PseudoConsole

Dart_PostInteger_DL(options->port, exit_code);

return 0;

}

static void start_wait_exit_thread(HANDLE pid, Dart_Port port, HANDLE mutex, HPCON hpty)
{
WaitExitOptions *options = malloc(sizeof(WaitExitOptions));

options->pid = pid;
options->port = port;
options->hMutex = mutex;
options->hpty = hpty;  //  add htpy

DWORD thread_id;

HANDLE thread = CreateThread(NULL, 0, wait_exit_thread, options, 0, &thread_id);

if (thread == NULL)
{
    free(options);
}

}

If not close the Pseudo , when close the port , there is a conhost process can not be kill.

anhhna added a commit to anhhna/flutter_pty that referenced this issue Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant