summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-02-11 15:20:37 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-02-11 15:20:37 (GMT)
commitfaf1d78f0e68dafb8c624ca8f5ddcfafbbe7e775 (patch)
treecf57475166d9cecb053a312208812e190dbf581f
parenta80d0318d2c6fdaaad538515154acc68edfe3bbc (diff)
downloadtcl-faf1d78f0e68dafb8c624ca8f5ddcfafbbe7e775.zip
tcl-faf1d78f0e68dafb8c624ca8f5ddcfafbbe7e775.tar.gz
tcl-faf1d78f0e68dafb8c624ca8f5ddcfafbbe7e775.tar.bz2
[Bug 2949740]: Do not try to put a NULL pipeline channel into binary mode.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclIOCmd.c4
-rw-r--r--tests/ioCmd.test5
3 files changed, 11 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f0ac54b..a191aa1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-02-11 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tclIOCmd.c (Tcl_OpenObjCmd): [Bug 2949740]: Make sure that
+ we do not try to put a NULL pipeline channel into binary mode.
+
2010-02-09 Mo DeJong <mdejong@users.sourceforge.net>
[Bug 2826551, Patch 2948425]: Assorted regexp bugs related to -all,
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c
index 36ac04b..f2078f0 100644
--- a/generic/tclIOCmd.c
+++ b/generic/tclIOCmd.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIOCmd.c,v 1.65 2009/11/18 21:59:50 nijtmans Exp $
+ * RCS: @(#) $Id: tclIOCmd.c,v 1.66 2010/02/11 15:20:37 dkf Exp $
*/
#include "tclInt.h"
@@ -1171,7 +1171,7 @@ Tcl_OpenObjCmd(
break;
}
chan = Tcl_OpenCommandChannel(interp, cmdObjc, cmdArgv, flags);
- if (binary) {
+ if (binary && chan) {
Tcl_SetChannelOption(interp, chan, "-translation", "binary");
}
}
diff --git a/tests/ioCmd.test b/tests/ioCmd.test
index ce9c98e..cafe3d9 100644
--- a/tests/ioCmd.test
+++ b/tests/ioCmd.test
@@ -13,7 +13,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: ioCmd.test,v 1.50 2009/08/06 22:28:12 andreas_kupries Exp $
+# RCS: @(#) $Id: ioCmd.test,v 1.51 2010/02/11 15:20:37 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -395,6 +395,9 @@ test iocmd-11.2 {I/O to command pipelines} {unixOrPc unixExecs} {
test iocmd-11.3 {I/O to command pipelines} {unixOrPc unixExecs} {
list [catch {open "| echo > \"$path(test5)\"" r+} msg] $msg $::errorCode
} {1 {can't read output from command: standard output was redirected} NONE}
+test iocmd-11.4 {I/O to command pipelines} unixOrPc {
+ list [catch {open "| no_such_command_exists" rb} msg] $msg $::errorCode
+} {1 {couldn't execute "no_such_command_exists": no such file or directory} {POSIX ENOENT {no such file or directory}}}
test iocmd-12.1 {POSIX open access modes: RDONLY} {
file delete $path(test1)