Skip to content

Electron process doesn't exit if pseudoterminal isn't fully killed before app is quit #733

@TheLazySquid

Description

@TheLazySquid

OS: Windows 10
Electron Version: 33.2.1
Node.js Version: 22.11.0
Node-pty Version: 1.1.0-beta27

Issue Description

If a pseudoterminal is created and the electron app is quit before it is fully killed, the process won't fully exit. From some testing it looks like the electron process still has conhost.exe and cmd.exe as children, so the issue might be that they aren't being shut down in time before the main node.js process is killed.

Reproduction

const { app } = require("electron");
const { spawn } = require("node-pty");

app.whenReady().then(() => {
    let pty = spawn("cmd.exe");

    // process doesn't exit
    setTimeout(() => {
        pty.kill();
        app.quit();
    }, 1000);

    // process exits normally
    // pty.kill();
    // setTimeout(() => {     
    //     app.quit();
    // }, 1000);
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions