Last active
July 31, 2018 23:23
Star
You must be signed in to star a gist
Docker + fifo + tmux bug ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Try this script on the docker container. | |
# Tested on macoOS High Sierra + Ubuntu 18.04 docker container. | |
rm -f "$HOME"/work/* | |
tmux -S "$HOME"/work/sess new-session -d | |
printf "%s\\n" A B C D | while read -r f;do | |
mkfifo "$HOME/work/$f" | |
echo "start to wait: mkfifo $HOME/work/$f" | |
_pane_id=$( tmux -S "$HOME"/work/sess splitw -P "grep -q 1 $HOME/work/$f"$'\n'"echo 'This is $f'" ) | |
echo "start logging: pipe-pane cat >> $HOME/work/$f.log" | |
tmux -S "$HOME"/work/sess pipe-pane -t "$_pane_id" "cat >> $HOME/work/$f.log" | |
done | |
printf "%s\\n" A B C D | while read -r f;do | |
echo "notify to $f" | |
printf "%s\\n" 1 > "$HOME/work/$f" & | |
done | |
sleep 5 | |
printf "%s\\n" "$HOME/work"/*.log | while read -r file;do | |
echo "$file" | |
cat "$file" | |
done | |
# $ bash fifo.sh | |
# start to wait: mkfifo /home/docker/work/A | |
# start logging: pipe-pane cat >> /home/docker/work/A.log | |
# start to wait: mkfifo /home/docker/work/B | |
# start logging: pipe-pane cat >> /home/docker/work/B.log | |
# start to wait: mkfifo /home/docker/work/C | |
# start logging: pipe-pane cat >> /home/docker/work/C.log | |
# start to wait: mkfifo /home/docker/work/D | |
# start logging: pipe-pane cat >> /home/docker/work/D.log | |
# notify to A | |
# notify to B | |
# notify to C | |
# notify to D | |
# /home/docker/work/A.log | |
# This is A | |
# /home/docker/work/B.log | |
# This is B | |
# /home/docker/work/C.log <<<<<<<<<<<<<<<<<<< WTF !? | |
# /home/docker/work/D.log <<<<<<<<<<<<<<<<<<< WTF !? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment