Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion common.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# shellcheck shell=bash
# Strict bash
set -euo pipefail

COMMAND_NAME="$1"
OUTPUT="${2-}"
if [[ -n "$OUTPUT" ]]; then
_OUTPUT_ABSOLUTE=$(realpath "$OUTPUT")
fi
TEMPORARIES_LOG=$(mktemp --tmpdir tmp."$COMMAND_NAME"-temp-log.XXXXXXXXXX)

function temp() {
Expand All @@ -19,7 +23,7 @@ function at_exit() {
rm -f "$TEMPORARIES_LOG"

# If this command has any output, ensure it has been produced
if [[ -n "$OUTPUT" && ! -e "$OUTPUT" ]]; then
if [[ -n "$OUTPUT" && ! -e "$_OUTPUT_ABSOLUTE" ]]; then
echo "Output not produced" > /dev/stderr
exit 1
fi
Expand Down