Skip to content

Commit

Permalink
Use a named pipe instead of the tty
Browse files Browse the repository at this point in the history
Works even if stdin is not a terminal.

Some programs can replace a fifo with a named pipe, which would break this.
For example: rsync without --specials
  • Loading branch information
lllusion3469 authored May 29, 2018
1 parent 0e69039 commit e3628fc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion atom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,16 @@ trap 'on_die' SIGQUIT SIGTERM

# If the wait flag is set, don't exit this process until Atom tells it to.
if [ $WAIT ]; then
WAIT_FIFO="$ATOM_HOME/.wait_fifo"
while true; do
[ -f "$WAIT_FIFO" ] && rm "$WAIT_FIFO"
[ ! -p "$WAIT_FIFO" ] && mkfifo "$WAIT_FIFO"
read < "$WAIT_FIFO" || break
sleep 1 # prevent a tight loop
done

# fall back to sleep
while true; do
read
sleep 1
done
fi

0 comments on commit e3628fc

Please sign in to comment.