Skip to content

Add --wait to code-server's own CLI - #8117

Open
b84330808 wants to merge 1 commit into
coder:mainfrom
b84330808:cli-wait-flag
Open

b84330808 wants to merge 1 commit into
coder:mainfrom
b84330808:cli-wait-flag

Conversation

@b84330808

Copy link
Copy Markdown

Fixes #8089

As suggested in the issue, this adds --wait to code-server's own script, so code-server --wait --reuse-window works as GIT_EDITOR even when that script is the one on PATH instead of remote-cli. It also works from a shell outside the integrated terminal, through the session socket.

It does what VS Code's remote-cli does: create a marker file, send it as waitMarkerFilePath with the open request, and return once Code deletes it after the files are closed. Like --reuse-window, --wait only opens in an existing instance and errors if there is none. -w is already --welcome-text, so there's no short flag.

Added unit tests for the wait loop (with a fake socket standing in for Code's) and for --wait not falling back to starting a server. I haven't run it against a full build.

Using `code-server --wait --reuse-window` as GIT_EDITOR fails with
"Unknown option --wait" whenever code-server's own script is the one on
PATH rather than the remote-cli script VS Code adds to the integrated
terminal (coder#8089). It also cannot be used as an editor from a shell
outside the integrated terminal.

With --wait, code-server now creates a marker file, passes it to Code
with the open request, and returns once Code deletes it, which Code
does when the opened files are closed. This is what VS Code's remote-cli
does. Like --reuse-window, --wait always opens in an existing instance.
@b84330808
b84330808 requested a review from a team as a code owner November 7, 2026 16:58

This branch has not been deployed

No deployments
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.

Cannot open files in integrated terminal

1 participant