| Ticket UUID: | 519868 | ||
| Title: | [fblocked] on cmd pipe always returns 0 | ||
| Type: | Bug | Created on: | 2002-02-19 11:10:51 |
| Submitter: | krischan | Assigned to: | andreas_kupries |
| Subsystem: | 25. Channel System | Severity: | |
| Priority: | 5 Medium | Last modified: | 2026-10-22 17:19:30 |
| Status: | Closed | Closed by: | serhiy.storchaka |
| Resolution: | Fixed | Closed on: | 2026-10-21 10:03:37 |
| Version: | obsolete: 8.4a3 | ||
| Description: | ||||
starting with Tcl8.1 the fblocked command applied to
a command pipe always returns false, even if the
recent [read] returned less bytes than wanted.
Example script:
puts Tcl:$tcl_patchLevel
set in [open "|/bin/sh -c {sleep 2; echo Hallo
Welt}"]
fconfigure $in -blocking 0 -translation binary
while {42} {
set bytes [read $in 11]
if {[eof $in]} {
close $in
break
}
puts [format "read of %d bytes was %sblocked" \
[string length $bytes] \
[expr {[fblocked $in] ? "" : "non "}]]
after 1100
}
Output for various Tcl versions:
> tcl8.0.5/unix/tclsh fblocked.tcl
Tcl:8.0.5
read of 0 bytes was blocked
read of 0 bytes was blocked
read of 11 bytes was non blocked
> tcl8.1.1/unix/tclsh fblocked.tcl
Tcl:8.1.1
read of 0 bytes was non blocked
read of 0 bytes was non blocked
read of 11 bytes was non blocked
> tcl8.4a3/unix/tclsh fblocked.tcl
Tcl:8.4a3
read of 0 bytes was non blocked
read of 0 bytes was non blocked
read of 11 bytes was non blocked
| ||||
| User Comments: | ||||
matzek added on 2004-05-03 19:02:28:
Logged In: YES user_id=330806 > /usr/local/ActiveTcl/bin/tclsh8.4 ~/fblocked.tcl Tcl:8.4.6 read of 0 bytes was non blocked read of 0 bytes was non blocked read of 11 bytes was non blocked Will this ever get fixed? serhiy.storchaka added on 2026-10-21 10:03:37:
Fixed in 8.5.16 and 8.6.2 by the CHANNEL_BLOCKED/EOF rework [2a40293a49] (8.5: [f6b7d496c4]): after a short non-blocking read from a command pipe, fblocked now returns 1. | ||||
