Skip to content

Commit 468a4d0

Browse files
committed
fixed bugs in the code command
1 parent bc28671 commit 468a4d0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

opt/cs50/bin/code

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,14 @@ if [ "$options" = false ]; then
8282
fi
8383

8484
# since /opt/cs50/bin already have higher precedence in PATH
85-
$(which -a code | grep remote-cli) "$@" || $(which -a code-insiders | grep remote-cli) "$@"
85+
remote_code=$(which -a code | grep remote-cli)
86+
remote_insiders=$(which -a code-insiders | grep remote-cli)
87+
88+
if [ -n "$remote_code" ]; then
89+
exec "$remote_code" "$@"
90+
elif [ -n "$remote_insiders" ]; then
91+
exec "$remote_insiders" "$@"
92+
else
93+
echo "Error: Could not find VS Code remote CLI" >&2
94+
exit 1
95+
fi

0 commit comments

Comments
 (0)