Skip to content

Commit e278301

Browse files
committed
Add a windows launcher to the standalone release
The standalone release ships bin/code-server, a shell script that resolves its own location and execs the bundled node against the release root. Windows cannot run it, so a windows release arrives with no way to start it that does not involve knowing where node ended up and typing both paths. This adds the same launcher as a .cmd, copied into bin/ only when OS is windows, so no other release changes at all. It is deliberately the shortest thing that works: %~dp0 gives the bin directory, the root is one above it, and the bundled node is handed the root and every argument. Verified against a real windows release tree: --version answers, it works from any working directory, and a bad flag comes back as exit code 1. Two things a reviewer should know. The shell launcher resolves symlinks before computing the root, because of #1537; the .cmd does not, since %~dp0 reports the directory of the link rather than of the target and batch has no readlink. A copy of the file works anywhere, a symlink to it does not. And the file is checked in with CRLF, which is what a .cmd is expected to have on the platform it runs on and what a windows checkout would produce for it anyway.
1 parent 62284ed commit e278301

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

ci/build/build-release.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ main() {
4141
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
4242
chmod 755 "$RELEASE_PATH/bin/code-server"
4343

44+
# Windows cannot run the shell launcher, so it gets one of its own.
45+
if [ "$OS" = windows ]; then
46+
rsync ./ci/build/code-server.cmd "$RELEASE_PATH/bin/code-server.cmd"
47+
fi
48+
4449
# Delete the extra bin scripts.
4550
rm "$RELEASE_PATH/lib/vscode/bin/remote-cli/code-darwin.sh"
4651
rm "$RELEASE_PATH/lib/vscode/bin/remote-cli/code-linux.sh"

ci/build/code-server.cmd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@echo off
2+
3+
rem This script is intended to be bundled into the standalone releases.
4+
rem Runs code-server with the bundled node binary.
5+
6+
setlocal
7+
set "ROOT=%~dp0.."
8+
"%ROOT%\lib\node.exe" "%ROOT%" %*

0 commit comments

Comments
 (0)