X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=roguelike;h=cad9b707f66e311ad905ee635261f69ba249a46b;hb=160e1660559e70c53ab2fcfc8af6461f539c647d;hp=8ca2871a42c998aa1c0258c8474e4027cedc9549;hpb=8fda7f4bd21cfd663ded40522f533896672fab97;p=plomrogue diff --git a/roguelike b/roguelike index 8ca2871..cad9b70 100755 --- a/roguelike +++ b/roguelike @@ -1,32 +1,14 @@ #!/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 ] +# Wrapper to the script so that its suppressed server messages get read on exit. +# and server_run/ get's deleted in any case. +./start_server_client_union.sh "$@" +rm -rf ./server_run/ + +# For some reason, mere sync won't ensure a log is written out, so wait a while. +sync +sleep 0.5 +if [ -e ./log ] then - echo "Server failed generating worldstate file within given time limit." - false + cat log fi - -# Only start the interface when everything else went well. -kill -0 $! 2> /dev/null -./roguelike-client