2020-02-26 05:20:47 +07:00
|
|
|
#!/usr/bin/env sh
|
2020-04-30 18:52:54 +07:00
|
|
|
|
|
|
|
# This script is intended to be bundled into the static releases.
|
2020-04-23 04:45:53 +07:00
|
|
|
# Runs code-server with the bundled Node binary.
|
2020-02-26 05:20:47 +07:00
|
|
|
|
2020-04-23 04:45:53 +07:00
|
|
|
# More complicated than readlink -f or realpath to support macOS.
|
|
|
|
# See https://github.com/cdr/code-server/issues/1537
|
2020-04-30 18:52:54 +07:00
|
|
|
bin_dir() {
|
2020-04-23 04:45:53 +07:00
|
|
|
# We read the symlink, which may be relative from $0.
|
|
|
|
dst="$(readlink "$0")"
|
|
|
|
# We cd into the $0 directory.
|
2020-04-30 18:52:54 +07:00
|
|
|
cd "$(dirname "$0")" || exit 1
|
2020-04-23 04:45:53 +07:00
|
|
|
# Now we can cd into the dst directory.
|
2020-04-30 18:52:54 +07:00
|
|
|
cd "$(dirname "$dst")" || exit 1
|
2020-04-23 04:45:53 +07:00
|
|
|
# Finally we use pwd -P to print the absolute path of the directory of $dst.
|
2020-04-30 18:52:54 +07:00
|
|
|
pwd -P || exit 1
|
2020-04-23 04:45:53 +07:00
|
|
|
}
|
2020-02-26 05:20:47 +07:00
|
|
|
|
2020-04-30 18:52:54 +07:00
|
|
|
BIN_DIR=$(bin_dir)
|
|
|
|
exec "$BIN_DIR/../lib/node" "$BIN_DIR/.." "$@"
|