Skip to content

Instantly share code, notes, and snippets.

@TylerOderkirk
Created June 13, 2015 03:22
Show Gist options
  • Save TylerOderkirk/154ca1e762549be39f81 to your computer and use it in GitHub Desktop.
Save TylerOderkirk/154ca1e762549be39f81 to your computer and use it in GitHub Desktop.
# create a pty and attach it to python app's stdin/out
socat -ddd -ddd PTY,raw,echo=0 "EXEC:'python /home/tz/proj/dsc/stdinout_tofrom_named_pipe.py that',pty,raw,echo=0"
# create a second pty and attach it to python app's stdin/out
socat -ddd -ddd PTY,raw,echo=0 "EXEC:'python /home/tz/proj/dsc/stdinout_tofrom_named_pipe.py other',pty,raw,echo=0"
# write some binary data into the first pty (where '7' is what's printed by socat)
cat /bin/true > /dev/pts/7
# read some binary data from the second pty (where '11' is what's printed by socat)
cat /dev/pts/11 > /tmp/out
# kill above cat(1) process (simply use ctrl-c for SIGINT)
# ensure binary data was transmitted without error
md5sum /bin/true /tmp/out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment