]> asedeno.scripts.mit.edu Git - git.git/blobdiff - lib/console.tcl
git-gui: Teach console widget to use git_read
[git.git] / lib / console.tcl
index 297e8defa47c19769093880a16bf5b89b0078d63..03d0354d5ee4934b93784e949e07c694bd325236 100644 (file)
@@ -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]
 }
@@ -173,6 +166,14 @@ method chain {cmdlist {ok 1}} {
        }
 }
 
+method insert {txt} {
+       if {![winfo exists $w.m.t]} {_init $this}
+       $w.m.t conf -state normal
+       $w.m.t insert end "$txt\n"
+       set console_cr [$w.m.t index {end -1c}]
+       $w.m.t conf -state disabled
+}
+
 method done {ok} {
        if {$ok} {
                if {[winfo exists $w.m.s]} {