Skip to content

Commit

Permalink
--interactive: use winpty on MS Windows #87
Browse files Browse the repository at this point in the history
  • Loading branch information
mviereck committed Jan 24, 2019
1 parent dfd96f6 commit 7588b97
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Project website: https://github.com/mviereck/x11docker
[(#102)](https://github.com/mviereck/x11docker/issues/102)
- docker-for-win: Make sure container is terminated.
[(#106)](https://github.com/mviereck/x11docker/issues/106)
- `--interactive`: Use `winpty` for support on docker-for-win.
[(#87)](https://github.com/mviereck/x11docker/issues/87)

## [5.3.3](https://github.com/mviereck/x11docker/releases/tag/v5.3.3) - 2018-11-17
### Added
Expand Down
19 changes: 13 additions & 6 deletions x11docker
Original file line number Diff line number Diff line change
Expand Up @@ -4074,7 +4074,7 @@ create_dockerrc() { # create dockerrc: This script runs as root (or
[ "$Sharehosthome" = "no" ] && echo " echo mkdir -p $Containeruserhome"

echo " echo '# Copy files from /etc/skel into empty HOME'"
echo " echo '[ \"\$(find $Containeruserhome -mindepth 1 -print -quit)\" ] || cp -v -R /etc/skel/. $Containeruserhome'"
echo " echo '[ \"\$(find $Containeruserhome -mindepth 1 -print -quit)\" ] || cp -R /etc/skel/. $Containeruserhome'"
[ "$Sharehosthome" = "no" ] && {
while read -r Line; do
echo " echo '# create soft links of shared folders to fake home'"
Expand Down Expand Up @@ -4209,7 +4209,7 @@ create_dockerrc() { # create dockerrc: This script runs as root (or
echo "read Containerid < <($Dockercommand 2>>$Containerlogfile | rmcr)"
;;
yes)
echo "$Dockercommand <&0 &"
[ "$Winpty" ] && echo "$Winpty bash $Dockercommandfile <&0 &" || echo "$Dockercommand <&0 &"
echo "Containerid=$Containername"
;;
esac
Expand Down Expand Up @@ -5320,6 +5320,7 @@ create_cachefiles() { # create empty cache files owned by unprivileged
Containerpid1pidfile="$Cachefolder/$Containerpid1pidfile" && mkfile $Containerpid1pidfile
Containeruserfile="$Sharefolder/$Containeruserfile" && mkfile $Containeruserfile
Dockerrc="$Cachefolder/$Dockerrc" && mkfile $Dockerrc
Dockercommandfile="$Cachefolder/$Dockercommandfile" && mkfile $Dockercommandfile
Containerrootrc="$Sharefolder/$Containerrootrc" && mkfile $Containerrootrc
Containeripfile="$Cachefolder/$Containeripfile" && mkfile $Containeripfile
Xservercookie="$Cachefolder/$Xservercookie" && mkfile $Xservercookie
Expand Down Expand Up @@ -5779,10 +5780,13 @@ check_option_interferences() { # check multiple option interferences, change se
is not well integrated yet. Shells do not have job control,
and CTRL-C can behave different than expected." ;;
esac
[ "$Winsubsystem" ] && note "Option -i, --interactive: On MS Windows you need
to run x11docker with: winpty bash x11docker [...]
MSYS2 provides it as a package. On Cygwin it can be compiled from source.
WSL isn't supported yet."
[ "$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."
}
;;
esac

Expand Down Expand Up @@ -6202,6 +6206,7 @@ declare_variables() { # declare global variables
Winsubmount="" # path within subsystem to mounted Windows drives
Winsubpath="" # path within Windows to subsystem files
Winpidlist="" # List of stored Windows pids (currently vcxsrv.exe on WSL only)
Winpty="" # Path to winpty for --interactive on Windows

# Gaining root privileges to run docker
Passwordfrontend="" # --pw: method to prompt for password. one of pkexec, su, sudo, gksu, gksudo, kdesu, kdesudo, lxsu, lxsudo, beesu, auto, none
Expand Down Expand Up @@ -6232,6 +6237,7 @@ declare_variables() { # declare global variables

# docker related files
Dockerrc=dockerrc # generated script to check image, set up host and create $Imagecommandscript
Dockercommandfile=dockercommand # generated script only containing docker command, needed for --interactive
Containerrootrc=containerrootrc # generated script to set up container. runs as root in container.
Imagecommandscript=container.CMD.sh # generated script starting image comand in container
Containerlogfile=container.log # file to log output of container other than image command output
Expand Down Expand Up @@ -6768,6 +6774,7 @@ Parsed options: $Parsedoptions"
setup_capabilities # add linux capabilities if needed for some options. Default: --cap-drop=ALL
[ "$Sharehostdbus" = "yes" ] && setup_hostdbus # --hostdbus
create_dockercommand # create 'docker run' command
echo "$Dockercommand" >> $Dockercommandfile
verbose -d "Generated docker command:
$Dockercommand"

Expand Down

0 comments on commit 7588b97

Please sign in to comment.