Today I failed to connect VS Code to a CentOS 7 server via SSH and found the following error message from vscode's log output.
wget: unrecognized option '--no-config' Usage: wget [OPTION]... [URL]... Try `wget --help' for more options.
The reason is that VScode needs to download an update package via wget
and supply such an argument but wget
on CentOS 7 is outdated to support this option.
Fortunately, VS Code respects the PATH variable of the user.
So a viable solution is to create a wrapper script of wget
(important: chmod +x
to make it executable), and put it under ~/.local/bin
which is configured in PATH
in my .bashrc
(important: in front of system paths).
Then reload VS Code session to reconnect and it should be successful.
Codes of the wrapper:
#!/bin/bash
declare -a args
index=1
for arg in "$@"; do
if [[ $arg == "--no-config" ]]; then
continue
fi
args[$index]=$arg
let index=index+1
done
echo "${args[@]}"
/usr/bin/wget "${args[@]}" 2>&1