Modified the time command so that it correctly logs program output in the
correct file and logs time information into the another file.
git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@7077 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/RunSafely.sh b/RunSafely.sh
index cef8ae0..8875f2e 100755
--- a/RunSafely.sh
+++ b/RunSafely.sh
@@ -25,7 +25,19 @@
ulimit -t $ULIMIT
rm -f core core.*
ulimit -c unlimited
-(time -p $PROGRAM $* 2> $OUTFILE > $OUTFILE < $INFILE) 2> $OUTFILE.time
+
+#
+# Run the command, timing its execution.
+# The standard output and standard error of $PROGRAM should go in $OUTFILE,
+# and the standard error of time should go in $OUTFILE.time.
+#
+# Ah, the joys of shell programming!
+# To get the time program and the specified program different output filenames,
+# we tell time to launch a shell which in turn executes $PROGRAM with the
+# necessary I/O redirection.
+#
+(time sh -c "$PROGRAM $* >& $OUTFILE < $INFILE") >& $OUTFILE.time
+
if test $? -eq 0
then
touch $OUTFILE.exitok
@@ -39,4 +51,4 @@
rm -f StackTrace.$$ $corefile
fi
-exit 0
\ No newline at end of file
+exit 0