bin: fix handling of -o '>>-' in the close/reopen path

* tests/core/serial.test: Add test case.
* bin/common_file.cc: Fix it.
This commit is contained in:
Alexandre Duret-Lutz 2023-07-26 21:50:16 +02:00
parent 0923f8efe2
commit 61e43edde8
2 changed files with 25 additions and 6 deletions

View file

@ -91,3 +91,25 @@ cat >expected <<EOF
5 pass2
EOF
diff out expected
# The case where the output filename is a computed "-".
ltl2tgba 1 --name '-' > naut-.hoa
for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
ltl2tgba 1 --name "file$i" > naut$i.hoa
done
autfilt naut*.hoa naut*.hoa --output='>>%M' --format=%M > stdout
cat >expected <<EOF
-
-
EOF
diff stdout expected
cat >expected7 <<EOF
file7
file7
EOF
diff file7 expected7
cat >expected15 <<EOF
file15
file15
EOF
diff file15 expected15