From e55fdfef67297086f6fbb535aa12e0fff60dc115 Mon Sep 17 00:00:00 2001 From: mviereck Date: Wed, 29 Jan 2020 15:46:32 +0100 Subject: [PATCH] --interactive on MS Windows: Exit with error if winpty is missing #217 --- x11docker | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/x11docker b/x11docker index 12befda8..4ba2b20d 100755 --- a/x11docker +++ b/x11docker @@ -440,8 +440,9 @@ ${Colredbg}x11docker ERROR:${Colnorm} $Message } logentry() { # write into logfile [ -e "$Logfile" ] && { - [ "$Logmessages" ] && echo "$Logmessages" >>$Messagelogfile 2>/dev/null && Logmessages="" + [ -n "$Logmessages" ] && echo "$Logmessages" >>$Messagelogfile 2>/dev/null && Logmessages="" echo "$*" >>$Messagelogfile 2>/dev/null + : } || Logmessages="$Logmessages $*" } @@ -6762,6 +6763,16 @@ check_option_interferences() { # check multiple option interferences, change se # --interactive case $Interactive in yes) + case $Winsubsystem in + MSYS2|CYGWIN|WSL1) + Winpty="$(command -v winpty)" + Winpty="$(escapestring "$Winpty")" + [ "$Winpty" ] || error "Option -i, --interactive: On MS Windows you need 'winpty' + to run x11docker in interactive mode. MSYS2 provides winpty as a package. + On Cygwin it can be compiled from source. WSL1 isn't supported yet. + WSL2 might work, but is not tested yet." + ;; + esac [ "$Forwardstdin" = "yes" ] && { note "You cannot use --stdin along with --interactive. Fallback: Disabling option --stdin." @@ -6775,20 +6786,9 @@ check_option_interferences() { # check multiple option interferences, change se } case $Initsystem in systemd|openrc|runit|sysvinit) note "Option --interactive: Interactive mode with option - --init=$Initsystem is not well integrated yet. Shells do not have job - control, and CTRL-C can behave different than expected." ;; + --init=$Initsystem is not well integrated yet. + Shells do not have job control and CTRL-C can behave different than expected." ;; esac - [ "$Winsubsystem" ] && { - Winpty="$(command -v winpty)" - Winpty="$(escapestring "$Winpty")" - [ "$Winpty" ] || { - note "Option -i, --interactive: On MS Windows you need 'winpty' - to run x11docker in interactive mode. MSYS2 provides winpty as a package. - On Cygwin it can be compiled from source. WSL isn't supported yet. - Fallback: disabling option --interactive." - Interactive="no" - } - } ;; esac [ "$Interactive" = "yes" ] && Showcontaineroutput="no"