Created
January 26, 2024 01:45
-
-
Save apolopena/fba266c327b3f0c178bfcf3bae5b1383 to your computer and use it in GitHub Desktop.
patch_wsl_vscode_node
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
# Function patch_wsl_vscode_node | |
# Note: This is a hack for wsl vscode when using a distor than canno run binaries outside the path | |
# such as in the case of void linux. This hack also assumes that node is installed on the wsl linux distro | |
# Every vscode update will change the folder where the binaries that wsl vscode uses | |
# Hence on every update you will get an error when trying to run code from wsl like the following | |
# ${HOME}/.vscode-server/bin/8b3775030ed1a69b13e4f4c628c612102e30a681/bin/remote-cli/code: 12: ${HOME}/.vscode-server/bin/8b3775030ed1a69b13e4f4c628c612102e30a681/node: not found | |
# Pass in the latest hash where the binaries for vscode server on wsl resides | |
# And a new symlink will be created using the systems node binary | |
function patch_wsl_vscode_node() { | |
local hash="$1" | |
local system_node="$(which node)" | |
local node="${HOME}/.vscode-server/bin/${hash}/node" | |
if [ ! -f $node ]; then echo "Error there is no ${node}" && return 1; fi | |
rm "$node" && ln -s "$system_node" "$node" && echo "Success: $system_node symlinked to $node" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment