diff options
Diffstat (limited to 'lib/spawn')
| -rwxr-xr-x | lib/spawn | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -4,16 +4,19 @@ SOCKDIR=$(mktemp -d) SOCKF=${SOCKDIR}/usock +trap 'rm -rf $SOCKDIR' EXIT INT + # Start tmux, if needed -if ! tmux ls | grep -q rshsh; then - tmux new -s rshsh -d +if ! tmux ls | grep -q "$tmux_session"; then + tmux new -s "$tmux_session" -d fi # Create window -tmux new-window -t rshsh "socat UNIX-LISTEN:${SOCKF},umask=0077 file:\$(tty),raw,echo=0" +tmux new-window -t "$tmux_session" \ + "stty raw -echo ; socat file:\$(tty),raw,echo=0 UNIX-LISTEN:${SOCKF},umask=0077" # Wait for socket -while test ! -e ${SOCKF} ; do sleep 1 ; done +while test ! -e "${SOCKF}" ; do sleep 1 ; done # Use socat to ship data between the unix socket and STDIO. -exec socat STDIO UNIX-CONNECT:${SOCKF} +exec socat STDIO "UNIX-CONNECT:${SOCKF}" |
