diff options
Diffstat (limited to 'bin/try')
-rwxr-xr-x | bin/try | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -26,7 +26,8 @@ if [ "$#" -eq 0 ] ; then exit 2 fi -# Create a buffer file for the error output, and clean up the file when we exit +# Create a temporary directory with name in $td, and handle POSIX-ish traps to +# remove it when the script exits. td= cleanup() { [ -n "$td" ] && rm -fr -- "$td" @@ -40,9 +41,9 @@ for sig in EXIT HUP INT TERM ; do trap "cleanup $sig" "$sig" done td=$(mktd "$self") || exit -errbuff=$td/errbuff # Open a filehandle to the error buffer, just to save on file operations +errbuff=$td/errbuff exec 3>"$errbuff" # Keep trying the command, writing error output to the buffer file, and exit |