From 57ef2c98339af5fd40e99e44c420815f9ed0805f Mon Sep 17 00:00:00 2001 From: w0rp Date: Sun, 18 Sep 2016 23:58:04 +0100 Subject: Add support for checking Haskell code via a wrapper script which can be used for other tools, and fix a readline problem with the DMD wrapper script. --- stdin-wrapper | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 stdin-wrapper (limited to 'stdin-wrapper') diff --git a/stdin-wrapper b/stdin-wrapper new file mode 100755 index 00000000..b3f9a2f9 --- /dev/null +++ b/stdin-wrapper @@ -0,0 +1,23 @@ +#!/bin/bash -eu + +# This script implements a wrapper for any program which does not accept +# stdin input on most Unix machines. The input to the script is read to a +# temporary file, and the first argument sets a particular file extension +# for the temporary file. +# +# All of the following arguments are read as command to run. + +file_extension="$1" +shift + +temp_file=`mktemp` +mv "$temp_file" "$temp_file$file_extension" +temp_file="$temp_file$file_extension" + +trap "rm $temp_file" EXIT + +while read; do + echo "$REPLY" >> "$temp_file" +done + +"$@" "$temp_file" -- cgit v1.2.3