mirror of
https://gitlab.com/xonotic/xonotic
synced 2025-01-08 06:59:42 +00:00
19 lines
263 B
Bash
Executable File
19 lines
263 B
Bash
Executable File
#!/bin/sh
|
|
|
|
logfile=$1
|
|
shift
|
|
|
|
if ! lockfile-create "$logfile.lock" >/dev/null 2>&1; then
|
|
exit 1
|
|
fi
|
|
lockfile-touch "$logfile.lock" & lockpid=$!
|
|
|
|
if "$@" >"$logfile" 2>&1; then
|
|
: # all is well
|
|
else
|
|
cat "$logfile"
|
|
fi
|
|
|
|
kill $lockpid
|
|
lockfile-remove "$logfile.lock"
|