Skip to content

(pty): a detached child of a Git bash tab survives tab close #1015

Open

Description

@devsuitup

Symptom

Found during a live test of main 259011f. #941 ends the processes a tab started when the tab closes. Under PowerShell, a detached child and a foreground child both died within 3 s. Under Git bash, the default shell on this machine, the foreground child died. The detached child (spawn(..., {detached: true, windowsHide: true})) was still alive more than 10 s later, and this happened in two separate runs.

Likely cause (not verified)

MSYS/Cygwin start their children with CREATE_BREAKAWAY_FROM_JOB, and the job allows breakaway (windows-job-helper.ps1 sets limit 0x800, JOB_OBJECT_LIMIT_BREAKAWAY_OK). Such a child therefore leaves the tab's job.

To decide

Choose between two options:

  • Drop BREAKAWAY_OK, if nothing relies on it.
  • Also walk the process tree when the tab closes.

Measure which processes escape before choosing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions