From 9c42b7baffdf9e155ea93380f38e13a18d894ab5 Mon Sep 17 00:00:00 2001 From: Kristian Spangsege Date: Thu, 26 Sep 2013 20:45:56 +0200 Subject: [PATCH] Cheetah wrapper script no longer clobbers target file on error --- src/tightdb/objc/cheetah.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tightdb/objc/cheetah.sh b/src/tightdb/objc/cheetah.sh index ccf7c254e5..35076a8a87 100644 --- a/src/tightdb/objc/cheetah.sh +++ b/src/tightdb/objc/cheetah.sh @@ -2,7 +2,12 @@ source="$1" target="$2" if which cheetah >/dev/null 2>&1; then - cheetah fill --stdout "$source" >"$target" || exit 1 + temp_dir="$(mktemp -d "/tmp/cheetah.XXXXXXXXXX")" || exit 1 + temp_file="$temp_dir/file" + cheetah fill --stdout "$source" >"$temp_file" || exit 1 + cat "$temp_file" >"$target" || exit 1 + rm "$temp_file" || exit 1 + rmdir "$temp_dir" || exit 1 exit 0 fi