From 6cb164284e90f09d42fd4027a4c30a1491a0afae Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 11 Feb 2010 15:25:25 +0000 Subject: [Bug 2949740]: Do not try to put a NULL pipeline channel into binary mode. --- ChangeLog | 5 +++++ generic/tclIOCmd.c | 4 ++-- tests/ioCmd.test | 5 ++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1fc531a..481430d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-02-11 Donal K. Fellows + + * 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-07 Jan Nijtmans * tools/genStubs.tcl Backport various formatting (spacing) diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 00ca527..dce8ed7 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.51.2.2 2008/04/10 20:55:26 andreas_kupries Exp $ + * RCS: @(#) $Id: tclIOCmd.c,v 1.51.2.3 2010/02/11 15:25:25 dkf Exp $ */ #include "tclInt.h" @@ -1128,7 +1128,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 f27d2a0..4dde148 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.36.2.6 2009/08/06 22:28:44 andreas_kupries Exp $ +# RCS: @(#) $Id: ioCmd.test,v 1.36.2.7 2010/02/11 15:25:25 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -380,6 +380,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) -- cgit v0.12