aboutsummaryrefslogtreecommitdiff
path: root/lib/spawn
blob: 07c27d8a0bffff6af046df565e09596399ba61a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
. ./vars

SOCKDIR=$(mktemp -d)
SOCKF=${SOCKDIR}/usock

# Start tmux, if needed
if ! tmux ls | grep -q rshell; then
	tmux new -s rshell -d
fi
# Create window

# Let's just see it works
tmux new-window -t rshell "socat UNIX-LISTEN:${SOCKF},umask=0077 STDIO"

# Wait for socket
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}