# [PATCH] git-web--browse: Fix open HTML help pages from iTerm

3 messages from 2012-09-25 to 2012-09-27. Participants: Steffen Prohaska, Junio C Hamano.
Thread: https://gitlist.dev/t/31647

## Steffen Prohaska, 2012-09-25 18:16

Subject: [PATCH] git-web--browse: Fix open HTML help pages from iTerm
Message-ID: <1348597003-28403-1-git-send-email-prohaska@zib.de>
URL: https://gitlist.dev/e/1348597003-28403-1-git-send-email-prohaska%40zib.de

```
iTerm is an alternative to the default terminal emulation program on Mac
OS X.  git-web--browse wasn't aware of iTerm and failed to open HTML
help pages when used in a shell session running in iTerm, reporting "No
known browser available."  Now it works as expected.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
 git-web--browse.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/git-web--browse.sh b/git-web--browse.sh
index 1e82726..95ecf65 100755
--- a/git-web--browse.sh
+++ b/git-web--browse.sh
@@ -120,7 +120,8 @@ if test -z "$browser" ; then
 	fi
 	# SECURITYSESSIONID indicates an OS X GUI login session
 	if test -n "$SECURITYSESSIONID" \
-		-o "$TERM_PROGRAM" = "Apple_Terminal" ; then
+		-o "$TERM_PROGRAM" = "Apple_Terminal" \
+		-o "$TERM_PROGRAM" = "iTerm.app" ; then
 		browser_candidates="open $browser_candidates"
 	fi
 	# /bin/start indicates MinGW
-- 
1.7.12.1.403.g14e83b4

```

## Junio C Hamano, 2012-09-27 19:11

Subject: Re: [PATCH] git-web--browse: Fix open HTML help pages from iTerm
Message-ID: <7v3923qo0n.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v3923qo0n.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1348597003-28403-1-git-send-email-prohaska@zib.de>

```
Steffen Prohaska <prohaska@zib.de> writes:

> iTerm is an alternative to the default terminal emulation program on Mac
> OS X.  git-web--browse wasn't aware of iTerm and failed to open HTML
> help pages when used in a shell session running in iTerm, reporting "No
> known browser available."  Now it works as expected.
>
> Signed-off-by: Steffen Prohaska <prohaska@zib.de>
> ---
>  git-web--browse.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/git-web--browse.sh b/git-web--browse.sh
> index 1e82726..95ecf65 100755
> --- a/git-web--browse.sh
> +++ b/git-web--browse.sh
> @@ -120,7 +120,8 @@ if test -z "$browser" ; then
>  	fi
>  	# SECURITYSESSIONID indicates an OS X GUI login session
>  	if test -n "$SECURITYSESSIONID" \
> -		-o "$TERM_PROGRAM" = "Apple_Terminal" ; then
> +		-o "$TERM_PROGRAM" = "Apple_Terminal" \
> +		-o "$TERM_PROGRAM" = "iTerm.app" ; then
>  		browser_candidates="open $browser_candidates"
>  	fi

I do not have anything against iTerm, but could we have a solution
that does not force us to keep adding 47 different terminal program
names to the list over the longer term (no pun intended)?  For
example, "If on OS-X (which by the way does not seem to be checked
with the current logic) and environment TERM_PROGRAM is set to any
value", or something.

```

## Steffen Prohaska, 2012-09-27 19:31

Subject: Re: [PATCH] git-web--browse: Fix open HTML help pages from iTerm
Message-ID: <0D4FA057-D2C1-4235-961F-166FD9DCA4F4@zib.de>
URL: https://gitlist.dev/e/0D4FA057-D2C1-4235-961F-166FD9DCA4F4%40zib.de
In-Reply-To: <7v3923qo0n.fsf@alter.siamese.dyndns.org>

```

On Sep 27, 2012, at 9:11 PM, Junio C Hamano wrote:

> Steffen Prohaska <prohaska@zib.de> writes:
> 
>> iTerm is an alternative to the default terminal emulation program on Mac
>> OS X.  git-web--browse wasn't aware of iTerm and failed to open HTML
>> help pages when used in a shell session running in iTerm, reporting "No
>> known browser available."  Now it works as expected.
>> 
>> Signed-off-by: Steffen Prohaska <prohaska@zib.de>
>> ---
>> git-web--browse.sh | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/git-web--browse.sh b/git-web--browse.sh
>> index 1e82726..95ecf65 100755
>> --- a/git-web--browse.sh
>> +++ b/git-web--browse.sh
>> @@ -120,7 +120,8 @@ if test -z "$browser" ; then
>> 	fi
>> 	# SECURITYSESSIONID indicates an OS X GUI login session
>> 	if test -n "$SECURITYSESSIONID" \
>> -		-o "$TERM_PROGRAM" = "Apple_Terminal" ; then
>> +		-o "$TERM_PROGRAM" = "Apple_Terminal" \
>> +		-o "$TERM_PROGRAM" = "iTerm.app" ; then
>> 		browser_candidates="open $browser_candidates"
>> 	fi
> 
> I do not have anything against iTerm, but could we have a solution
> that does not force us to keep adding 47 different terminal program
> names to the list over the longer term (no pun intended)?  For
> example, "If on OS-X (which by the way does not seem to be checked
> with the current logic) and environment TERM_PROGRAM is set to any
> value", or something.

I googled a bit and it seems that TERM_PROGRAM is specific to OS X.
So simply testing whether TERM_PROGRAM is set to any value (without
additional check for OS X) might be good enough.

I am wondering whether anyone knows if TERM_PROGRAM is used on other
operating systems besides OS X.

	Steffen

```
