- if {[catch {
- set fd [open [concat $opt $cmdp $args] r]
- } err]} {
- if { [lindex $args end] eq {2>@1}
- && $err eq {can not find channel named "1"}
- } {
- # Older versions of Tcl 8.4 don't have this 2>@1 IO
- # redirect operator. Fallback to |& cat for those.
- # The command was not actually started, so its safe
- # to try to start it a second time.
- #
- set fd [open [concat \
- $opt \
- $cmdp \
- [lrange $args 0 end-1] \
- [list |& cat] \
- ] r]
- } else {
- error $err
- }
- }
- return $fd