-
-
Save john-h-k/b52eb9dc7ac2bb532342a538b902a526 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # Copyright (c) Microsoft Corporation. All rights reserved. | |
| # Licensed under the MIT License. See License.txt in the project root for license information. | |
| # when run in remote terminal, use the remote cli | |
| if [ -n "$VSCODE_IPC_HOOK_CLI" ]; then | |
| REMOTE_CLI="$(which -a 'code' | grep /remote-cli/)" | |
| if [ -n "$REMOTE_CLI" ]; then | |
| "$REMOTE_CLI" "$@" | |
| exit $? | |
| fi | |
| fi | |
| function app_realpath() { | |
| SOURCE=$1 | |
| while [ -h "$SOURCE" ]; do | |
| DIR=$(dirname "$SOURCE") | |
| SOURCE=$(readlink "$SOURCE") | |
| [[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE | |
| done | |
| SOURCE_DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" | |
| echo "${SOURCE_DIR%%${SOURCE_DIR#*.app}}" | |
| } | |
| APP_PATH="$(app_realpath "${BASH_SOURCE[0]}")" | |
| if [ -z "$APP_PATH" ]; then | |
| echo "Unable to determine app path from symlink : ${BASH_SOURCE[0]}" | |
| exit 1 | |
| fi | |
| CONTENTS="$APP_PATH/Contents" | |
| ELECTRON="$CONTENTS/MacOS/Electron" | |
| CLI="$CONTENTS/Resources/app/out/cli.js" | |
| export VSCODE_NODE_OPTIONS=$NODE_OPTIONS | |
| export VSCODE_NODE_REPL_EXTERNAL_MODULE=$NODE_REPL_EXTERNAL_MODULE | |
| unset NODE_OPTIONS | |
| unset NODE_REPL_EXTERNAL_MODULE | |
| ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@" | |
| exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment