From f9c39b7ae8218121f16e1b0b7f70c1cff52a56c0 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 24 Mar 2022 02:54:54 -0700 Subject: bugfix: execing awk causes temp files to persist. --- cppawk | 2 +- testcases | 5 +++++ testdir/testdel | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100755 testdir/testdel diff --git a/cppawk b/cppawk index bd80d4c..f33cab8 100755 --- a/cppawk +++ b/cppawk @@ -151,7 +151,7 @@ while [ $# -gt 0 ] ; do shift done -awk="exec $(quote "$awk")" +awk="command $(quote "$awk")" prepro="command $(quote "$prepro")" trap 'rm -f $tmp_file' EXIT INT TERM diff --git a/testcases b/testcases index 9f88f67..2711d4b 100644 --- a/testcases +++ b/testcases @@ -200,3 +200,8 @@ gawk=__gawk__ ./cppawk --prepro=die --prepro-only x 2>&1 | grep 'not found' : ./cppawk: 1: eval: die: not found +-- +37: +tmp=$(./cppawk --awk=testdir/testdel 1); [ -e $tmp ] || echo gone +: +gone diff --git a/testdir/testdel b/testdir/testdel new file mode 100755 index 0000000..f6339c8 --- /dev/null +++ b/testdir/testdel @@ -0,0 +1,3 @@ +#!/bin/sh +[ "$1" = "-f" ] || exit 1 +printf "%s\n" "$2" -- cgit v1.2.3