diff options
author | Steve Bennett <steveb@workware.net.au> | 2017-10-21 13:25:08 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2017-10-21 13:25:47 +1000 |
commit | 105f8475cd9e1c4aeb328c341dc01228488a1524 (patch) | |
tree | 98971c84994d6009453f657b597d6f63dc88b413 /tests/exec2.test | |
parent | fd965a0c4f35d959d12d747e2e3162390a1579f2 (diff) | |
download | jimtcl-105f8475cd9e1c4aeb328c341dc01228488a1524.zip jimtcl-105f8475cd9e1c4aeb328c341dc01228488a1524.tar.gz jimtcl-105f8475cd9e1c4aeb328c341dc01228488a1524.tar.bz2 |
tests: Use a more explicit approach to test SIGPIPE
Write to a closed pipe in exec2-3.2 to force SIGPIPE
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests/exec2.test')
-rw-r--r-- | tests/exec2.test | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/exec2.test b/tests/exec2.test index 13a4ff0..22eef47 100644 --- a/tests/exec2.test +++ b/tests/exec2.test @@ -5,6 +5,7 @@ source [file dirname [info script]]/testing.tcl needs cmd exec +testConstraint pipe [expr {[info commands pipe] ne ""}] set d \" set s ' @@ -51,9 +52,14 @@ test exec2-3.1 "close pipeline return value" { list $rc $msg $status $exitcode } {1 {child process exited abnormally} CHILDSTATUS 1} -test exec2-3.2 "close pipeline return value" -body { +# Note that on at least one Windows system, this fails to return SIGPIPE +# and cat simply fails instead. How to it simply returns +test exec2-3.2 "close pipeline return value" -constraints pipe -body { + # Create a pipe and immediately close the read end + lassign [pipe] r w + close $r set bigstring [string repeat a 10000] - set f [open [list |cat << $bigstring]] + set f [open [list |cat << $bigstring >$@w]] set rc [catch {close $f} msg opts] lassign [dict get $opts -errorcode] status pid exitcode list $rc $msg $status $exitcode |