summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorferrieux <ferrieux@users.sourceforge.net>2017-08-24 16:56:51 (GMT)
committerferrieux <ferrieux@users.sourceforge.net>2017-08-24 16:56:51 (GMT)
commit1dac20d62e354430a8f82e46bf0805c70cdde4e3 (patch)
tree147a113c91eebbea669e756992af82d64adc0402
parent092ff2b2cdc4b956187625e58d2469dd94fdfdd4 (diff)
downloadtcl-1dac20d62e354430a8f82e46bf0805c70cdde4e3.zip
tcl-1dac20d62e354430a8f82e46bf0805c70cdde4e3.tar.gz
tcl-1dac20d62e354430a8f82e46bf0805c70cdde4e3.tar.bz2
Fix [b50fb214] : add to 2>> the same O_APPEND that was added to >> back in 2005.
-rw-r--r--generic/tclPipe.c8
-rw-r--r--tests/exec.test8
2 files changed, 13 insertions, 3 deletions
diff --git a/generic/tclPipe.c b/generic/tclPipe.c
index d6cd188..b679ec4 100644
--- a/generic/tclPipe.c
+++ b/generic/tclPipe.c
@@ -668,7 +668,13 @@ TclCreatePipeline(
if (*p == '>') {
p++;
atOK = 0;
- flags = O_WRONLY | O_CREAT;
+
+ /*
+ * Note that the O_APPEND flag only has an effect on POSIX
+ * platforms. On Windows, we just have to carry on regardless.
+ */
+
+ flags = O_WRONLY | O_CREAT | O_APPEND;
}
if (errorClose != 0) {
errorClose = 0;
diff --git a/tests/exec.test b/tests/exec.test
index 2a4b31e..dffd960 100644
--- a/tests/exec.test
+++ b/tests/exec.test
@@ -671,8 +671,12 @@ test exec-19.1 {exec >> uses O_APPEND} -constraints {exec unix} -setup {
exec /bin/sh -c \
{for a in 1 2 3; do sleep 1; echo $a; done} >>$tmpfile &
exec /bin/sh -c \
+ {for a in 4 5 6; do sleep 1; echo $a >&2; done} 2>>$tmpfile &
+ exec /bin/sh -c \
{for a in a b c; do sleep 1; echo $a; done} >>$tmpfile &
- # The above two shell invokations take about 3 seconds to finish, so allow
+ exec /bin/sh -c \
+ {for a in d e f; do sleep 1; echo $a >&2; done} 2>>$tmpfile &
+ # The above four shell invokations take about 3 seconds to finish, so allow
# 5s (in case the machine is busy)
after 5000
# Check that no bytes have got lost through mixups with overlapping
@@ -681,7 +685,7 @@ test exec-19.1 {exec >> uses O_APPEND} -constraints {exec unix} -setup {
file size $tmpfile
} -cleanup {
removeFile $tmpfile
-} -result 14
+} -result 26
# Tests to ensure batch files and .CMD (Bug 9ece99d58b)
# can be executed on Windows