Skip to content

Windows OS conhost problem #5

@movade005

Description

@movade005

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions