threads / patch / 22561

patchgit-gui: check whether systems nice command works or disable it

Subject: [PATCH] git-gui: check whether systems nice command works or disable it

## tl;dr

3 messages between Feb 7, 2010 and Feb 8, 2010. Diffs are folded; open one to read it.

replies: 2people: 3as markdown or json

Heiko Voigt· Feb 7, 2010, 21:47 UTC · lore

This fixes issue 394 from msysgit. It seems that the Gnuwin32 project provides a nice command but it returns a "not implemented" error. To help users we now try to execute once and disable it in case it fails.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---

see: http://code.google.com/p/msysgit/issues/detail?id=394 for more information.

cheers Heiko
 git-gui/git-gui.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Show changes to git-gui/git-gui.sh +3 −0
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 1fb3cbf..eec2dc9 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -388,6 +388,9 @@ proc _lappend_nice {cmd_var} {
 
 	if {![info exists _nice]} {
 		set _nice [_which nice]
+		if {[catch {exec $_nice git version}]} {
+			set _nice {}
+		}
 	}
 	if {$_nice ne {}} {
 		lappend cmd $_nice
-- 
1.7.0.rc1.7.gc0da5
Junio C Hamano· Feb 8, 2010, 00:21 UTC · re: Heiko Voigt · lore

Re: [PATCH] git-gui: check whether systems nice command works or disable it

Heiko Voigt <hvoigt@hvoigt.net> writes:
Show 26 quoted lines
> This fixes issue 394 from msysgit. It seems that the Gnuwin32 project
> provides a nice command but it returns a "not implemented" error. To
> help users we now try to execute once and disable it in case it fails.
>
> Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
> ---
>
> see: http://code.google.com/p/msysgit/issues/detail?id=394
> for more information.
>
> cheers Heiko
>
>  git-gui/git-gui.sh |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
> index 1fb3cbf..eec2dc9 100755
> --- a/git-gui/git-gui.sh
> +++ b/git-gui/git-gui.sh
> @@ -388,6 +388,9 @@ proc _lappend_nice {cmd_var} {
>  
>  	if {![info exists _nice]} {
>  		set _nice [_which nice]
> +		if {[catch {exec $_nice git version}]} {
> +			set _nice {}
> +		}
Where does the output from this "git version" invocation go?
Show 5 quoted lines
>  	}
>  	if {$_nice ne {}} {
>  		lappend cmd $_nice
> -- 
> 1.7.0.rc1.7.gc0da5
Shawn O. Pearce· Feb 8, 2010, 15:56 UTC · re: Junio C Hamano · lore

Re: [PATCH] git-gui: check whether systems nice command works or disable it

Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
> > diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
> > index 1fb3cbf..eec2dc9 100755
> > --- a/git-gui/git-gui.sh
> > +++ b/git-gui/git-gui.sh
> > @@ -388,6 +388,9 @@ proc _lappend_nice {cmd_var} {
> >  
> >  	if {![info exists _nice]} {
> >  		set _nice [_which nice]
> > +		if {[catch {exec $_nice git version}]} {
> > +			set _nice {}
> > +		}
> 
> Where does the output from this "git version" invocation go?

By default Tcl exec returns stdout's contents. So in this case, its passed to catch, which discards it, because catch returns true if exec crashed, false if it ran without error.

Patch looks fine to me as-is.
-- 
Shawn.

← back to recent threads