]> git.xonotic.org Git - xonotic/xonotic.git/blob - misc/infrastructure/cat-if-error.sh
Fix macOS SDL2 framework permissions
[xonotic/xonotic.git] / misc / infrastructure / cat-if-error.sh
1 #!/bin/sh
2
3 logfile=$1
4 shift
5
6 if ! lockfile-create "$logfile.lock" >/dev/null 2>&1; then
7         exit 1
8 fi
9 lockfile-touch "$logfile.lock" & lockpid=$!
10
11 if "$@" >"$logfile" 2>&1; then
12         : # all is well
13 else
14         cat "$logfile"
15 fi
16
17 kill $lockpid
18 lockfile-remove "$logfile.lock"