Skip to content
Merged
Show file tree
Hide file tree
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
54 changes: 54 additions & 0 deletions AppDir/bin/cli-router.hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/sh

# when run in remote terminal, use the remote cli
if [ -n "$VSCODE_IPC_HOOK_CLI" ]; then
REMOTE_CLI=""
_IFS=$IFS
IFS=:
for d in $PATH; do
case "$d" in
*/remote-cli/*)
if REMOTE_CLI=$(PATH=$d command -v code); then
break
fi
;;
esac
done
IFS=$_IFS
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 VS Code with the Windows Subsystem for Linux, please install VS Code in Windows and uninstall the Linux version in WSL. You can then use the \`code\` 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
case "$YN" in
y|Y|yes|Yes|YES) :;;
*) exit 1;;
esac
echo "To no longer see this prompt, start VS Code with the environment variable DONT_PROMPT_WSL_INSTALL defined." 1>&2
fi

# If root, ensure that --user-data-dir or --file-write is specified
if [ "$APPIMAGE_UID" = 0 ]; then
for i do
case "$i" in
--user-data-dir|--user-data-dir=*|--file-write|tunnel|serve-web)
CAN_LAUNCH_AS_ROOT=1
;;
esac
done
if [ -z "$CAN_LAUNCH_AS_ROOT" ]; then
echo "You are trying to start VS Code as a super user which isn't recommended. If this was intended, please add the argument \`--no-sandbox\` and specify an alternate user data directory using the \`--user-data-dir\` argument." 1>&2
exit 1
fi
fi

ELECTRON=$APPDIR/bin/code
CLI=$APPDIR/bin/resources/app/out/cli.js
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
exit $?
2 changes: 1 addition & 1 deletion get-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ sed -i \
./AppDir/code.desktop ./AppDir/share/applications/code-url-handler.desktop

# not needed
rm -rf ./AppDir/bin/resources/app/node_modules/@github/copilot-linuxmusl-x64
rm -rf ./AppDir/bin/resources/app/node_modules/@github/copilot-linuxmusl-x64