Skip to content

Fix/windows job object protection#860

Open
ilyaxuwu wants to merge 5 commits into
CodebuffAI:mainfrom
ilyaxuwu:fix/windows-job-object-protection
Open

Fix/windows job object protection#860
ilyaxuwu wants to merge 5 commits into
CodebuffAI:mainfrom
ilyaxuwu:fix/windows-job-object-protection

Conversation

@ilyaxuwu

@ilyaxuwu ilyaxuwu commented Jul 10, 2026

Copy link
Copy Markdown

Job Object protection has been added to prevent child processes spawned in Windows from remaining active when the parent crashes.

isolated-command.ts — Using Bun.FFI, CreateJobObjectW, AssignProcessToJobObject, and SetInformationJobObject are called via kernel32.dll. Thanks to the JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE flag, Windows automatically cleans up the child process when the parent dies. If FFI cannot be found, it silently falls back.
run-terminal-command.ts — After spawning, protectChildWithJob(pid) is called, and cleanup is triggered on the process close event.

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

Successfully merging this pull request may close these issues.

1 participant