Skip to content

Windows: Studio launched by open outlives the shell that ran it - #2

Closed
Blueeyy wants to merge 1 commit into
Unsquared:mainfrom
Blueeyy:windows-detach
Closed

Blueeyy wants to merge 1 commit into
Unsquared:mainfrom
Blueeyy:windows-detach

Conversation

@Blueeyy

@Blueeyy Blueeyy commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Found while running the Windows checklist in CLAUDE.md on 3.1.0 (Windows 11, Studio 0.745).

The bug

open --copy (and open) on Windows:

  1. Studio dies about a second after it connects. The daemon logs Studio connected (copy …) then Studio disconnected (copy …) in the same second; Studio's own log stops mid-line with no shutdown, and its process is gone. cmd /c start was spawned attached to the caller's console and process group, and Studio went with them when the CLI exited. 2.1.1 launched with Node's detached: true and didn't do this.
  2. Detached, the caller then hangs until Studio exits. Rust spawns with handle inheritance on, and the CLI's own stdio came in inheritable, so cmd and then Studio inherit the caller's output pipe. Any shell that reads the CLI's output (studio-sync open --copy | tail, an agent's tool call) waits on that pipe until the copy is closed.

The fix

In windows_launch: creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP), and before spawning, clear HANDLE_FLAG_INHERIT on this process's standard handles (GetStdHandle/SetHandleInformation from kernel32, no new crate).

Checked on Windows

  • open --copy: returns in ~9 s, the copy stays open and connected after the command ends.
  • The rest of the checklist on 3.1.0 as released: install (startup launcher, plugin in %LOCALAPPDATA%\Roblox\Plugins, skill), live sync including a CRLF script (wait in 0.3 s), build (finds rokit's rojo), snapshot --from <placeId>, close (kills Studio, deletes the file and .lock, moves the AutoRecovery file to backups) all work.
  • cargo fmt --check and cargo clippy --all-targets are clean. I did not run cargo test.

🤖 Generated with Claude Code

Detached from the caller's console and process group, and with this process's
standard handles made non-inheritable first: attached, Studio died a second
after it connected; inheriting the caller's output pipe, it held a shell that
read the CLI's output until Studio exited.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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