]> granicus.if.org Git - re2c/commitdiff
run_tests.sh: avoid using 'sed -i' as it is non-portable.
authorUlya Trofimovich <skvadrik@gmail.com>
Mon, 31 Jul 2017 14:05:44 +0000 (15:05 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Mon, 31 Jul 2017 14:05:44 +0000 (15:05 +0100)
On FreeBSD 'sed -i' works in a different way than on Linux.

re2c/run_tests.sh.in

index d7475fdbdf39530638038506b749d92dbd2b1847..fb2abc8d61f0a55928a72653e41a22253befcc85 100644 (file)
@@ -171,7 +171,11 @@ run_pack() {
                        # run re2c
                        $valgrind $wine ../../$re2c $switches "$outx" 2>"$outc.stderr" 1>&2
                        # on windows output contains CR LF, cut CR to match test results
-                       [ -f "$outc" ] && lc_run sed -i 's/\r//g' "$outc" "$outc.stderr"
+                       for f in "$outc" "$outc.stderr"; do
+                               [ -f "$f" ] \
+                                       && cat "$f" | lc_run tr -d '\r' > "$f".mod \
+                                       && mv "$f".mod "$f"
+                       done
                        # paste all files dropped by re2c into output file
                        rm "$outx" && find . -type f \
                                | lc_run sort \