From 1085ce6f27989a6b6282c8f3c61d66eff10cc7d9 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 1 Mar 2017 13:55:31 -0800 Subject: [PATCH] bin: get --daemon working on OSX. --- bin/bcoin | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/bcoin b/bin/bcoin index 315f0ee7..0df74c54 100755 --- a/bin/bcoin +++ b/bin/bcoin @@ -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 &