From: Christian Heller Date: Wed, 9 Jul 2014 23:31:17 +0000 (+0200) Subject: Add wrapper script over wrapper script so log messages get read on exit. X-Git-Tag: tce~717 X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/%7B%7Bitem_name%7D%7D?a=commitdiff_plain;h=e851cb0c3df489c68f29bb6cef02c7bc061c3251;p=plomrogue Add wrapper script over wrapper script so log messages get read on exit. --- diff --git a/TODO b/TODO index 276d56f..d9f1594 100644 --- a/TODO +++ b/TODO @@ -4,10 +4,6 @@ IN GENERAL: - expand use of hardcoded_strings module(s) -ROGUELIKE SKRIPT - -- do something about the invisibility of error messages - BOTH SERVER/CLIENT: - make server and client communicate by specific world state info requests @@ -15,6 +11,8 @@ BOTH SERVER/CLIENT: SERVER: +- bug: -v works, and -vs, but not -sv – why? + - consider diff --git a/roguelike b/roguelike index 8ca2871..efb362c 100755 --- a/roguelike +++ b/roguelike @@ -1,32 +1,6 @@ #!/bin/sh -# Abort the script on error. -set -e - -# Use shell script's arguments for server and pipe server output to log file. -./roguelike-server "$@" > log 2>&1 & - -# Give server some time to start up and exit on error. -sleep 0.01 - -# The client should not start if the server is not running. (If the server was -# running in the foreground, any error exit of it so far would be caught by "set -# -e" above. But "set -e" is blind to error codes generated in the background.) -kill -0 $! 2> /dev/null - -# Give server some time (max. 10 seconds) to generate its worldstate file. -i=0 -while [ ! -e server/worldstate ] && [ $i -le 1000 ] -do - sleep 0.01 - i=`expr $i + 1` -done -if [ ! -e server/worldstate ] -then - echo "Server failed generating worldstate file within given time limit." - false -fi - -# Only start the interface when everything else went well. -kill -0 $! 2> /dev/null -./roguelike-client +# Wrapper to the script so that its suppressed server messages get read on exit. +./start_server_client_union.sh "$@" +sync +cat log diff --git a/start_server_client_union.sh b/start_server_client_union.sh new file mode 100755 index 0000000..57133aa --- /dev/null +++ b/start_server_client_union.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +# Abort the script on error. +set -e + +# Use shell script's arguments for server and pipe server output to log file. +# 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 + +# The client should not start if the server is not running. (If the server was +# running in the foreground, any error exit of it so far would be caught by "set +# -e" above. But "set -e" is blind to error codes generated in the background.) +kill -0 $! 2> /dev/null + +# Give server some time (max. 10 seconds) to generate its worldstate file. +i=0 +while [ ! -e server/worldstate ] && [ $i -le 1000 ] +do + sleep 0.01 + i=`expr $i + 1` +done +if [ ! -e server/worldstate ] +then + echo "Server failed generating worldstate file within given time limit." + false +fi + +# Only start the interface when everything else went well. +kill -0 $! 2> /dev/null +./roguelike-client