Skip to content

Commit

Permalink
Change atom.sh not to spawn a sleep process every second on --wait
Browse files Browse the repository at this point in the history
As sleep(1) is not a bash builtin, every second a new process is spawed.
To  prevent this, the POSIX read can be used instead.
Since it is (required to be) a bash builtin, it is immediately killed along with bash unlike a longer running sleep would be.
In case stdin is e.g. /dev/null for whatever reason (this would break EDITOR=nano), sleep is still kept to prevent a tight loop.
  • Loading branch information
lllusion3469 authored May 24, 2018
1 parent a78d682 commit 0e69039
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions atom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ trap 'on_die' SIGQUIT SIGTERM
# If the wait flag is set, don't exit this process until Atom tells it to.
if [ $WAIT ]; then
while true; do
read
sleep 1
done
fi

0 comments on commit 0e69039

Please sign in to comment.