From: Christian Heller Date: Wed, 9 Jul 2014 23:50:49 +0000 (+0200) Subject: Handle (non-existence) of log file smarter in start / wrapper scripts. X-Git-Tag: tce~714 X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdb.prefix%7D%7D/%7B%7Bprefix%7D%7D/blog?a=commitdiff_plain;h=9a45da3c6ecdeccd30e07e18a93023cfb08cef39;p=plomrogue Handle (non-existence) of log file smarter in start / wrapper scripts. --- diff --git a/roguelike b/roguelike index efb362c..a0be8cc 100755 --- a/roguelike +++ b/roguelike @@ -3,4 +3,7 @@ # Wrapper to the script so that its suppressed server messages get read on exit. ./start_server_client_union.sh "$@" sync -cat log +if [ -e ./log ] +then + cat log +fi diff --git a/start_server_client_union.sh b/start_server_client_union.sh index ac161b5..6199e25 100755 --- a/start_server_client_union.sh +++ b/start_server_client_union.sh @@ -3,6 +3,12 @@ # Abort the script on error. set -e +# Don't let any log leftovers from before interfere. +if [ -e ./log ] +then + rm log +fi + # Give helpful message to players that want to start without compiling first. if [ ! -e ./roguelike-server ] then @@ -19,8 +25,6 @@ fi # This script's wrapper script will read it out on exit. ./roguelike-server "$@" > log 2>&1 & -echo TEST >> log - # Give server some time to start up and exit on error. sleep 0.01