]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Bugfix: Quote in a posix compliant manner 3745/head
authorMatthias Maier <tamiko@43-1.org>
Sun, 8 Jan 2017 23:10:25 +0000 (17:10 -0600)
committerMatthias Maier <tamiko@43-1.org>
Sun, 8 Jan 2017 23:10:25 +0000 (17:10 -0600)
cmake/scripts/run_test.sh

index 72a39a7a81e9273b25ed41f7761f0281d5caec81..53c82727f762f94efdb4f4c4af4527276d17905f 100644 (file)
@@ -31,7 +31,14 @@ NUMDIFF_EXECUTABLE="$3"
 DIFF_EXECUTABLE="$4"
 COMPARISON_FILE="$5"
 shift 5
-RUN_COMMAND=( "$@" )
+
+save () {
+  for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ;
+  done
+  echo " "
+}
+
+RUN_COMMAND=$(save "$@")
 
 # Ensure uniform sorting for pathname expansion
 export LC_ALL=C
@@ -45,7 +52,8 @@ run(){
   rm -f output
   rm -f stdout
 
-  "${RUN_COMMAND[@]}" > stdout 2>&1
+  eval "set -- ${RUN_COMMAND}"
+  "$@" > stdout 2>&1
   RETURN_VALUE=$?
 
   [ -f output ] || mv stdout output

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.