fail early if creating a temporary file failed - json2tsv - JSON to TSV converter (HTM) git clone git://git.codemadness.org/json2tsv (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit 994b5ebefdc81372822b42917e254ee1b0728db0 (DIR) parent 6bc2f0c4a81a8b4877385d396fac72e931a90e30 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Sun, 23 Apr 2023 12:22:51 +0200 fail early if creating a temporary file failed Diffstat: M jaq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- (DIR) diff --git a/jaq b/jaq @@ -12,7 +12,7 @@ fi expr="$*" # POSIX way to simulate -o pipefail if JSON data is invalid. -statusfile=$(mktemp) +statusfile="$(mktemp)" || exit 1 trap -- "rm -f \"${statusfile}\"" "EXIT" { json2tsv ${nflag} -r -F '\x1f' -R '\x1e'; echo $? >"${statusfile}"; } | \ LC_ALL=C awk "BEGIN { FS = \"\x1f\"; RS = \"\x1e\" }${expr}"