diff options
author | rubidium <rubidium@openttd.org> | 2010-02-18 18:20:15 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-02-18 18:20:15 +0000 |
commit | 30520d7762d16d6aac56913a686d5679de74aff0 (patch) | |
tree | 77bfb1e6d39a3da3ffece96530decf46ec7f9737 /os/debian/openttd-wrapper | |
parent | 3a3696473437193f411e60a56f8371a6fa1904b9 (diff) | |
download | openttd-30520d7762d16d6aac56913a686d5679de74aff0.tar.xz |
(svn r19162) -Update: the debian packaging; bring it in sync with the packaging used at debian (minus the splitting)
Diffstat (limited to 'os/debian/openttd-wrapper')
-rw-r--r-- | os/debian/openttd-wrapper | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/os/debian/openttd-wrapper b/os/debian/openttd-wrapper new file mode 100644 index 000000000..3c35f7d36 --- /dev/null +++ b/os/debian/openttd-wrapper @@ -0,0 +1,26 @@ +#!/bin/sh +# This is a wrapper script that checks openttd's exit status and +# displays its stderr output + +# Get a file to capture stderr to +TMPFILE=`mktemp --tmpdir openttd.errout.XXXXXXXXX` + +if [ ! -w "$TMPFILE" ]; then + xmessage "Could not create temporary file for error messages. Not starting OpenTTD." + exit 1; +fi + +# Capture stderr +openttd "$@" 2> "$TMPFILE" +ERRCODE=$? +if [ "$ERRCODE" -ne 0 ]; then + CODEMSG="OpenTTD returned with error code $ERRCODE." + if [ -s "$TMPFILE" ]; then + MESSAGE="$CODEMSG The following error messages were produced:\n\n" + printf "$MESSAGE" | cat - "$TMPFILE" | fold -s | xmessage -file - + else + xmessage "$CODEMSG No error messages were produced." + fi +fi + +rm -f "$TMPFILE" |