use remote cli when in remote terminal (#150372)

This commit is contained in:
Martin Aeschlimann 2022-05-25 16:21:16 +02:00 committed by GitHub
parent 986ef1c76d
commit 07655f3a23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 4 deletions

View file

@ -288,6 +288,7 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
all = es.merge(all, gulp.src('resources/linux/code.png', { base: '.' }));
} else if (platform === 'darwin') {
const shortcut = gulp.src('resources/darwin/bin/code.sh')
.pipe(replace('@@APPNAME@@', product.applicationName))
.pipe(rename('bin/code'));
all = es.merge(all, shortcut);
@ -333,7 +334,7 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
} else if (platform === 'linux') {
result = es.merge(result, gulp.src('resources/linux/bin/code.sh', { base: '.' })
.pipe(replace('@@PRODNAME@@', product.nameLong))
.pipe(replace('@@NAME@@', product.applicationName))
.pipe(replace('@@APPNAME@@', product.applicationName))
.pipe(rename('bin/' + product.applicationName)));
}

View file

@ -3,6 +3,15 @@
# 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 '@@APPNAME@@' | grep /remote-cli/)"
if [ -n "$REMOTE_CLI" ]; then
"$REMOTE_CLI" "$@"
exit $?
fi
fi
function app_realpath() {
SOURCE=$1
while [ -h "$SOURCE" ]; do

View file

@ -3,9 +3,18 @@
# 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 '@@APPNAME@@' | grep /remote-cli/)"
if [ -n "$REMOTE_CLI" ]; then
"$REMOTE_CLI" "$@"
exit $?
fi
fi
# test that VSCode wasn't installed inside WSL
if grep -qi Microsoft /proc/version && [ -z "$DONT_PROMPT_WSL_INSTALL" ]; then
echo "To use @@PRODNAME@@ with the Windows Subsystem for Linux, please install @@PRODNAME@@ in Windows and uninstall the Linux version in WSL. You can then use the \`@@NAME@@\` command in a WSL terminal just as you would in a normal command prompt." 1>&2
echo "To use @@PRODNAME@@ with the Windows Subsystem for Linux, please install @@PRODNAME@@ in Windows and uninstall the Linux version in WSL. You can then use the \`@@APPNAME@@\` command in a WSL terminal just as you would in a normal command prompt." 1>&2
printf "Do you want to continue anyway? [y/N] " 1>&2
read -r YN
YN=$(printf '%s' "$YN" | tr '[:upper:]' '[:lower:]')
@ -44,11 +53,11 @@ else
VSCODE_PATH="$(dirname "$(readlink -f "$0")")/.."
else
# else use the standard install location
VSCODE_PATH="/usr/share/@@NAME@@"
VSCODE_PATH="/usr/share/@@APPNAME@@"
fi
fi
ELECTRON="$VSCODE_PATH/@@NAME@@"
ELECTRON="$VSCODE_PATH/@@APPNAME@@"
CLI="$VSCODE_PATH/resources/app/out/cli.js"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" --ms-enable-electron-run-as-node "$@"
exit $?