X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=roguelike;h=8ca2871a42c998aa1c0258c8474e4027cedc9549;hb=5ae8d71f6b87c0cfc6b3ecf974f2cfbd6a611733;hp=dadab3cb2c776725c4b496a9e623115cb08d869a;hpb=1c7e780b3486f025aed46957328cba88983c34b1;p=plomrogue diff --git a/roguelike b/roguelike index dadab3c..8ca2871 100755 --- a/roguelike +++ b/roguelike @@ -3,25 +3,30 @@ # Abort the script on error. set -e -# Use the shell script's arguments to the server's arguments. -./roguelike-server $@ & +# 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 foreround, any error exit of it so far would be caught by "set +# 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 out file. +# Give server some time (max. 10 seconds) to generate its worldstate file. i=0 -while [ ! -e server/out ] && [ $i -le 10000 ] +while [ ! -e server/worldstate ] && [ $i -le 1000 ] do sleep 0.01 i=`expr $i + 1` done -kill -0 $! 2> /dev/null +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