mirror of
https://github.com/atom/atom.git
synced 2026-01-21 04:48:12 -05:00
Closes #351 When Sparkle updates Atom, it deletes the app and replaces it. This causes the `atom` cli to fail when called within this brief time period. This gives `atom` a five second grace period if it is not found.
29 lines
518 B
Bash
29 lines
518 B
Bash
#!/bin/sh
|
|
ATOM_PATH=/Applications/Atom.app
|
|
|
|
if [ ! -d $ATOM_PATH ]; then sleep 5; fi # Wait for Atom to reappear, Sparkle may be replacing it.
|
|
|
|
open -a $ATOM_PATH -n --args --executed-from="$(pwd)" --pid=$$ $@
|
|
|
|
# Used to exit process when atom is used as $EDITOR
|
|
on_die() {
|
|
exit 0
|
|
}
|
|
trap 'on_die' SIGQUIT SIGTERM
|
|
|
|
# Don't exit process if we were told to wait.
|
|
while [ "$#" -gt "0" ]; do
|
|
case $1 in
|
|
-W|--wait)
|
|
WAIT=1
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
if [ $WAIT ]; then
|
|
while true; do
|
|
sleep 1
|
|
done
|
|
fi
|