bin: get --daemon working on OSX.

This commit is contained in:
Christopher Jeffrey 2017-03-01 13:55:31 -08:00
parent bade290765
commit 1085ce6f27
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -6,7 +6,7 @@ cmd='node'
if ! type perl > /dev/null 2>& 1; then
if uname | grep -i 'darwin' > /dev/null; then
echo 'Bcoin requires perl to start.' >& 2
echo 'Bcoin requires perl to start on OSX.' >& 2
exit 1
fi
rl=1
@ -50,9 +50,13 @@ for arg in "$@"; do
done
if test $daemon -eq 1; then
# And yet again, OSX doesn't support something.
if ! type setsid > /dev/null 2>& 1; then
echo 'Bcoin requires setsid to start as a daemon.' >& 2
exit 1
(
"${dir}/${cmd}" "$@" > /dev/null 2>& 1 &
echo "$!"
)
exit 0
fi
(
setsid "${dir}/${cmd}" "$@" > /dev/null 2>& 1 &