aboutsummaryrefslogtreecommitdiff
path: root/lib/spawn
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2019-02-14 20:26:09 -0500
committerMitch Riedstra <mitch@riedstra.us>2019-02-14 20:26:09 -0500
commitbd13ba3f12da9721ae9e0a81af788a3f9d9bb8f8 (patch)
treed88c28b69dd421fdbbdc6833e9590c0a28ee4c0b /lib/spawn
downloadrshsh-bd13ba3f12da9721ae9e0a81af788a3f9d9bb8f8.tar.gz
rshsh-bd13ba3f12da9721ae9e0a81af788a3f9d9bb8f8.tar.xz
Initial
Diffstat (limited to 'lib/spawn')
-rwxr-xr-xlib/spawn20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/spawn b/lib/spawn
new file mode 100755
index 0000000..07c27d8
--- /dev/null
+++ b/lib/spawn
@@ -0,0 +1,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}