Skip to content
Open
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
13 changes: 9 additions & 4 deletions src/serverSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ SERVER_DOWNLOAD_URL="$(echo "${serverDownloadUrlTemplate.replace(/\$\{/g, '\\${'

# Check if server script is already installed
if [[ ! -f $SERVER_SCRIPT ]]; then
extract_dir="$(mktemp -d)"
case "$PLATFORM" in
darwin | linux | alpine )
;;
Expand All @@ -334,9 +335,9 @@ if [[ ! -f $SERVER_SCRIPT ]]; then
pushd $SERVER_DIR > /dev/null

if [[ ! -z $(which wget) ]]; then
wget --tries=3 --timeout=10 --continue --no-verbose -O vscode-server.tar.gz $SERVER_DOWNLOAD_URL
wget --tries=3 --timeout=10 --continue --no-verbose -O "$extract_dir/vscode-server.tar.gz" $SERVER_DOWNLOAD_URL
elif [[ ! -z $(which curl) ]]; then
curl --retry 3 --connect-timeout 10 --location --show-error --silent --output vscode-server.tar.gz $SERVER_DOWNLOAD_URL
curl --retry 3 --connect-timeout 10 --location --show-error --silent --output "$extract_dir/vscode-server.tar.gz" $SERVER_DOWNLOAD_URL
else
echo "Error no tool to download server binary"
print_install_results_and_exit 1
Expand All @@ -347,7 +348,7 @@ if [[ ! -f $SERVER_SCRIPT ]]; then
print_install_results_and_exit 1
fi

tar -xf vscode-server.tar.gz --strip-components 1
tar -xf "$extract_dir/vscode-server.tar.gz" --strip-components 1
if (( $? > 0 )); then
echo "Error while extracting server contents"
print_install_results_and_exit 1
Expand All @@ -358,7 +359,11 @@ if [[ ! -f $SERVER_SCRIPT ]]; then
print_install_results_and_exit 1
fi

rm -f vscode-server.tar.gz
rm -f "$extract_dir/vscode-server.tar.gz"

cp -r "$extract_dir/*" .

rm -rf "$extract_dir"

popd > /dev/null
else
Expand Down