From c953749fec5f522e2c0ba0eaf580c020794cbc98 Mon Sep 17 00:00:00 2001 From: Michael Riedmann Date: Mon, 28 Mar 2022 15:05:28 +0200 Subject: [PATCH] add newline filtering to cmd.exe calls (fix #37) --- docker/root/usr/local/bin/startup | 6 ++++-- docker/root/usr/local/bin/wsl-vpnkit | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docker/root/usr/local/bin/startup b/docker/root/usr/local/bin/startup index a6ca2b3..40cfe29 100644 --- a/docker/root/usr/local/bin/startup +++ b/docker/root/usr/local/bin/startup @@ -1,7 +1,9 @@ -#!/bin/sh +#!/bin/bash + +set -eo pipefail CMDSHELL="$(command -v cmd.exe || echo '/mnt/c/Windows/system32/cmd.exe')" -APPDATA=$(wslpath "$($CMDSHELL /V:OFF /C 'echo | set /p t=%APPDATA%' 2>/dev/null)") +APPDATA="$(wslpath "$($CMDSHELL /V:OFF /C 'echo %APPDATA%' | tr -d '\n\r')")" mkdir -p "$APPDATA/DockerInWsl/config" diff --git a/docker/root/usr/local/bin/wsl-vpnkit b/docker/root/usr/local/bin/wsl-vpnkit index 24390a1..d26aaad 100644 --- a/docker/root/usr/local/bin/wsl-vpnkit +++ b/docker/root/usr/local/bin/wsl-vpnkit @@ -1,8 +1,10 @@ -#!/bin/sh +#!/bin/bash + +set -eo pipefail CMDSHELL="$(command -v cmd.exe || echo '/mnt/c/Windows/system32/cmd.exe')" -PROGRAMFILES=$(wslpath "$($CMDSHELL /V:OFF /C 'echo | set /p t=%PROGRAMFILES%' 2>/dev/null)") -LOCALAPPDATA=$(wslpath "$($CMDSHELL /V:OFF /C 'echo | set /p t=%LOCALAPPDATA%' 2>/dev/null)") +PROGRAMFILES="$(wslpath "$($CMDSHELL /V:OFF /C 'echo %PROGRAMFILES%' | tr -d '\n\r')")" +LOCALAPPDATA="$(wslpath "$($CMDSHELL /V:OFF /C 'echo %LOCALAPPDATA%' | tr -d '\n\r')")" CONF_PATH="$LOCALAPPDATA/DockerInWSL/wsl-vpnkit/wsl-vpnkit.conf" HTTP_PROXY_CONFIG_PATH="$LOCALAPPDATA/DockerInWSL/wsl-vpnkit/http-proxy.json" SOCKET_PATH="/var/run/wsl-vpnkit.sock"