From 003803778de0b359a3a99792e8f5d4c94c6544d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Sachse?= <joerg.sachse@slub-dresden.de>
Date: Fri, 14 Oct 2022 17:03:25 +0200
Subject: [PATCH] fix: remove temporary file if there's an error while writing
 it (e.g. due to insufficient disk space)

---
 validate_workflow.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/validate_workflow.sh b/validate_workflow.sh
index c7fb3f1..bd1bd83 100755
--- a/validate_workflow.sh
+++ b/validate_workflow.sh
@@ -470,7 +470,7 @@ if [ "$WITH_PIPE" -eq 1 ]; then
     #cli mode, use stdin
     debug "checking stream"
     filename=$(mktemp --tmpdir validate_wrg.XXXX)
-    cat - > "$filename"
+    cat - > "$filename" || rm -f "${filename}"
     scan_file "$filename"
     rm -f "$filename" || error "could not remove temporary file '$filename'"
 else 
-- 
GitLab