Skip to content

Fix code-server.sh script on macOS #1546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions ci/code-server.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
#!/usr/bin/env sh
# code-server.sh -- Run code-server with the bundled Node binary.
# Runs code-server with the bundled Node binary.

dir="$(dirname "$(readlink -f "$0" || realpath "$0")")"
# More complicated than readlink -f or realpath to support macOS.
# See https://github.com/cdr/code-server/issues/1537
get_installation_dir() {
# We read the symlink, which may be relative from $0.
dst="$(readlink "$0")"
# We cd into the $0 directory.
cd "$(dirname "$0")"
# Now we can cd into the dst directory.
cd "$(dirname "$dst")"
# Finally we use pwd -P to print the absolute path of the directory of $dst.
pwd -P
}

dir=$(get_installation_dir)
exec "$dir/node" "$dir/out/node/entry.js" "$@"