Closed
Description
alternative Title: exec.Command with ssh doesn't work when there are spaces in args
(I'm pondering how to best fix this for one of my apps too :) )
sven@x1carbon:/tmp/space path$ ./sshocker --debug -p 8080:80 -v .:/tmp/sshfs xeon
DEBU[0000] executing ssh for preparing sshfs: /usr/bin/ssh [ssh -o ControlMaster=auto -o ControlPath=~/.ssh/sshocker-%r@%h:%p-232029 -o ControlPersist=yes xeon -- mkdir -p /tmp/sshfs]
DEBU[0000] executing ssh for remote sshfs: /usr/bin/ssh [ssh -o ControlMaster=auto -o ControlPath=~/.ssh/sshocker-%r@%h:%p-232029 -o ControlPersist=yes xeon -- sshfs :/tmp/space path /tmp/sshfs -o slave]
DEBU[0000] starting sftp server for /tmp/space path
DEBU[0000] generated script "wait-for-remote-ready" with map map[Dir:/tmp/sshfs MaxTrial:30]: "#!/bin/sh\nset -eu\ndir=\"/tmp/sshfs\"\nmax_trial=\"30\"\nLANG=C\nLC_ALL=C\nexport LANG LC_ALL\ni=0\nwhile : ; do\n # FIXME: not really robust\n if mount | grep \"on ${dir}\" | egrep -qw \"fuse.sshfs|osxfuse\"; then\n echo '{\"return\":{}}'\n exit 0\n fi\n sleep 1\n if [ $i -ge ${max_trial} ]; then\n echo >&2 \"sshfs does not seem to be mounted on ${dir}\"\n exit 1\n fi\n i=$((i + 1))\ndone\n"
DEBU[0000] executing ssh for script "wait-for-remote-ready": /usr/bin/ssh [ssh -o ControlMaster=auto -o ControlPath=~/.ssh/sshocker-%r@%h:%p-232029 -o ControlPersist=yes xeon -- /bin/sh]
fuse: bad mount point `path': No such file or directory
DEBU[0000] sftp server for /tmp/space path exited with EOF (negligible) error=EOF
DEBU[0031] executed script "wait-for-remote-ready", stdout="", stderr="sshfs does not seem to be mounted on /tmp/sshfs\n", err=failed to execute script "wait-for-remote-ready": stdout="", stderr="sshfs does not seem to be mounted on /tmp/sshfs\n": exit status 1
WARN[0031] failed to confirm whether /tmp/sshfs [remote] is successfully mounted error="failed to execute script \"wait-for-remote-ready\": stdout=\"\", stderr=\"sshfs does not seem to be mounted on /tmp/sshfs\\n\": exit status 1"
DEBU[0031] executing main SSH: /usr/bin/ssh [ssh -o ControlMaster=auto -o ControlPath=~/.ssh/sshocker-%r@%h:%p-232029 -o ControlPersist=yes -L 0.0.0.0:8080:localhost:80 xeon --]
Last login: Thu Oct 8 10:03:54 2020 from 10.10.10.146
sven@xeon:~$