vscode-extensions: remote-ssh acquires user's home directory from $HOME (#122595)

This commit is contained in:
Iosmanthus Teng 2021-05-18 09:06:56 +08:00 committed by GitHub
parent 01a5232c3b
commit 4927716658
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@
, vscode-utils , vscode-utils
, useLocalExtensions ? false}: , useLocalExtensions ? false}:
# Note that useLocalExtensions requires that vscode-server is not running # Note that useLocalExtensions requires that vscode-server is not running
# on host. If it is, you'll need to remove ~/.vscode-server, # on host. If it is, you'll need to remove $HOME/.vscode-server,
# and redo the install by running "Connect to host" on client # and redo the install by running "Connect to host" on client
let let
@ -11,7 +11,7 @@ let
# patch runs on remote machine hence use of which # patch runs on remote machine hence use of which
# links to local node if version is 12 # links to local node if version is 12
patch = '' patch = ''
f="/home/''$USER/.vscode-server/bin/''$COMMIT_ID/node" f="$HOME/.vscode-server/bin/$COMMIT_ID/node"
localNodePath=''$(which node) localNodePath=''$(which node)
if [ -x "''$localNodePath" ]; then if [ -x "''$localNodePath" ]; then
localNodeVersion=''$(node -v) localNodeVersion=''$(node -v)
@ -23,10 +23,10 @@ let
fi fi
${lib.optionalString useLocalExtensions '' ${lib.optionalString useLocalExtensions ''
# Use local extensions # Use local extensions
if [ -d ~/.vscode/extensions ]; then if [ -d $HOME/.vscode/extensions ]; then
if ! test -L "~/.vscode-server/extensions"; then if ! test -L "$HOME/.vscode-server/extensions"; then
mkdir -p ~/.vscode-server mkdir -p $HOME/.vscode-server
ln -s ~/.vscode/extensions ~/.vscode-server/ ln -s $HOME/.vscode/extensions $HOME/.vscode-server/
fi fi
fi fi
''} ''}