summaryrefslogtreecommitdiff
path: root/lib/console.tcl
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-07-09 07:07:05 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-07-09 07:07:05 (GMT)
commit74c4763c76a111809747652210962ad09896b74f (patch)
tree9094f1e0c23d07a1d816521af342e6070bbbe8e9 /lib/console.tcl
parentc136f2b8b9eaac7a702799de25648b74ef12618a (diff)
downloadgit-74c4763c76a111809747652210962ad09896b74f.zip
git-74c4763c76a111809747652210962ad09896b74f.tar.gz
git-74c4763c76a111809747652210962ad09896b74f.tar.bz2
git-gui: Teach console widget to use git_read
Now that we are pretty strict about setting up own absolute paths to any git helper (saving a marginal runtime cost to resolve the tool) we can do the same in our console widget by making sure all console execs go through git_read if they are a git subcommand, and if not make sure they at least try to use the Tcl 2>@1 IO redirection if possible, as it should be faster than |& cat. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib/console.tcl')
-rw-r--r--lib/console.tcl17
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/console.tcl b/lib/console.tcl
index 27a880e..03d0354 100644
--- a/lib/console.tcl
+++ b/lib/console.tcl
@@ -87,19 +87,12 @@ method _init {} {
}
method exec {cmd {after {}}} {
- # -- Cygwin's Tcl tosses the enviroment when we exec our child.
- # But most users need that so we have to relogin. :-(
- #
- if {[is_Cygwin]} {
- set cmd [list sh --login -c "cd \"[pwd]\" && [join $cmd { }]"]
+ if {[lindex $cmd 0] eq {git}} {
+ set fd_f [eval git_read --stderr [lrange $cmd 1 end]]
+ } else {
+ lappend cmd 2>@1
+ set fd_f [_open_stdout_stderr $cmd]
}
-
- # -- Tcl won't let us redirect both stdout and stderr to
- # the same pipe. So pass it through cat...
- #
- set cmd [concat | $cmd |& cat]
-
- set fd_f [open $cmd r]
fconfigure $fd_f -blocking 0 -translation binary
fileevent $fd_f readable [cb _read $fd_f $after]
}