# [PATCH] git help -w should not create nohup.out

11 messages from 2008-02-08 to 2008-02-10. Participants: Dmitry Potapov, Johannes Schindelin, Junio C Hamano, Christian Couder.
Thread: https://gitlist.dev/t/11957

## Dmitry Potapov, 2008-02-08 01:33

Subject: [PATCH] git help -w should not create nohup.out
Message-ID: <1202434421-8066-1-git-send-email-dpotapov@gmail.com>
URL: https://gitlist.dev/e/1202434421-8066-1-git-send-email-dpotapov%40gmail.com

```
git-help--browse uses 'nohup' to launch some browsers. If the output is not
redirected, 'nohup' creates 'nohup.out' and prints a warning about that. It
was mighty annoying to see this warning as well as to have empty nohup.out
files scattered everywhere you happened to use 'git help -w'.

This patch redirects the output to /dev/null when a GUI browser is launched
using the 'nohup' command; thus 'nohup.out' is not created.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
---

Initially I thought to redict the output to $HOME/.git-nohup.out instead of
/dev/null, so no output will be lost if an error happen. But the only error
that a GUI browser may want to report to the stderr or stdout is a problem
inside Xlib (like connection to X display or something like that), and when
it happens you cannot run your favorite browser from the command line anyway.
So, it is very noticeably and no problem to diagnose without any nohup.out
created by git help.

 git-help--browse.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/git-help--browse.sh b/git-help--browse.sh
index 10b0a36..320e836 100755
--- a/git-help--browse.sh
+++ b/git-help--browse.sh
@@ -122,7 +122,7 @@ case "$browser" in
 	vers=$(expr "$($browser_path -version)" : '.* \([0-9][0-9]*\)\..*')
 	NEWTAB='-new-tab'
 	test "$vers" -lt 2 && NEWTAB=''
-	nohup "$browser_path" $NEWTAB $pages &
+	nohup "$browser_path" $NEWTAB $pages > /dev/null &
 	;;
     konqueror)
 	case "$(basename "$browser_path")" in
@@ -136,7 +136,7 @@ case "$browser" in
 		eval "$browser_path" newTab $pages
 		;;
 	    *)
-	        nohup "$browser_path" $pages &
+	        nohup "$browser_path" $pages > /dev/null &
 		;;
 	esac
 	;;
@@ -144,6 +144,6 @@ case "$browser" in
 	eval "$browser_path" $pages
 	;;
     dillo)
-	nohup "$browser_path" $pages &
+	nohup "$browser_path" $pages > /dev/null &
 	;;
 esac
-- 
1.5.4

```

## Johannes Schindelin, 2008-02-08 01:55

Subject: Re: [PATCH] git help -w should not create nohup.out
Message-ID: <alpine.LSU.1.00.0802080153570.11591@racer.site>
URL: https://gitlist.dev/e/alpine.LSU.1.00.0802080153570.11591%40racer.site
In-Reply-To: <1202434421-8066-1-git-send-email-dpotapov@gmail.com>

```
Hi,

On Fri, 8 Feb 2008, Dmitry Potapov wrote:

> git-help--browse uses 'nohup' to launch some browsers.

Why?

"nohup" should be used to start a program that should persist even after 
you logged out.  I fail to see how this should be sensible for "git help 
-w".  So "off with the head", uh, do away with the "nohup", I say!

Ciao,
Dscho

```

## Junio C Hamano, 2008-02-08 03:40

Subject: Re: [PATCH] git help -w should not create nohup.out
Message-ID: <7vhcgkm7yy.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vhcgkm7yy.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <alpine.LSU.1.00.0802080153570.11591@racer.site>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Hi,
>
> On Fri, 8 Feb 2008, Dmitry Potapov wrote:
>
>> git-help--browse uses 'nohup' to launch some browsers.
>
> Why?
>
> "nohup" should be used to start a program that should persist even after 
> you logged out.  I fail to see how this should be sensible for "git help 
> -w".  So "off with the head", uh, do away with the "nohup", I say!

True.  Christian, what was the reason you added nohup?
I would imagine if you did this:

	(1) open a new xterm;

        (2) in that xterm, run the browser, perhaps from
            git-help--browse, but without nohup, in the
            background;

	(3) exit the terminal

then the browser might get upset, losing its controlling
terminal.

But I suspect that would be a really broken behaviour.

```

## Christian Couder, 2008-02-08 05:37

Subject: Re: [PATCH] git help -w should not create nohup.out
Message-ID: <200802080637.04015.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/200802080637.04015.chriscool%40tuxfamily.org
In-Reply-To: <7vhcgkm7yy.fsf@gitster.siamese.dyndns.org>

```
Le vendredi 8 février 2008, Junio C Hamano a écrit :
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> > Hi,
> >
> > On Fri, 8 Feb 2008, Dmitry Potapov wrote:
> >> git-help--browse uses 'nohup' to launch some browsers.
> >
> > Why?
> >
> > "nohup" should be used to start a program that should persist even
> > after you logged out.  I fail to see how this should be sensible for
> > "git help -w".  So "off with the head", uh, do away with the "nohup", I
> > say!
>
> True.  Christian, what was the reason you added nohup?

I think I was worried about something like this:

1) ssh -Y other_machine
2) git help -w, it opens my browser
3) open many other tabs in the browser
4) exit other_machine, oops my browser with all my tabs is gone

or

1) open my favorite browser and many tabs in it
2) ssh -Y other_machine
3) git help -w, cool it opens a tab in my already opened browser in 1)
4) exit other_machine, oops my browser with all my tabs is gone

I thought it would perhaps help, and it was better to be on the safe side. 
But I just tested a little and it seems it doesn't change anything.

Also there are some browser that are very verbose on the SDTOUT or STDERR 
(especially konqueror) and I thought the nohup would also help move the 
output out of the command line while not discarding it in case it's needed. 
But I agree that it's not very often usefull and anyway there are better 
ways to deal with it.

So no problem to do away with the "nohup".

Thanks,
Christian.

```

## Dmitry Potapov, 2008-02-08 10:33

Subject: Re: [PATCH] git help -w should not create nohup.out
Message-ID: <20080208103307.GT30368@dpotapov.dyndns.org>
URL: https://gitlist.dev/e/20080208103307.GT30368%40dpotapov.dyndns.org
In-Reply-To: <7vhcgkm7yy.fsf@gitster.siamese.dyndns.org>

```
On Thu, Feb 07, 2008 at 07:40:21PM -0800, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > Hi,
> >
> > On Fri, 8 Feb 2008, Dmitry Potapov wrote:
> >
> >> git-help--browse uses 'nohup' to launch some browsers.
> >
> > Why?
> >
> > "nohup" should be used to start a program that should persist even after 
> > you logged out.  I fail to see how this should be sensible for "git help 
> > -w".  So "off with the head", uh, do away with the "nohup", I say!
> 
> True.  Christian, what was the reason you added nohup?
> I would imagine if you did this:
> 
> 	(1) open a new xterm;
> 
>         (2) in that xterm, run the browser, perhaps from
>             git-help--browse, but without nohup, in the
>             background;
> 
> 	(3) exit the terminal
> 
> then the browser might get upset, losing its controlling
> terminal.

I also thought so, therefore, I suggested to redict the output to
/dev/null instead of removing "nohup", but now after some testing,
it seems there is no need for "nohup" here. So, unless Christian
has a good reason for "nohup", I agree with Johannes that "nohup"
should be removed.


Dmitry

```

## Dmitry Potapov, 2008-02-08 11:25

Subject: Re: [PATCH] git help -w should not create nohup.out
Message-ID: <20080208112543.GV30368@dpotapov.dyndns.org>
URL: https://gitlist.dev/e/20080208112543.GV30368%40dpotapov.dyndns.org
In-Reply-To: <200802080637.04015.chriscool@tuxfamily.org>

```
On Fri, Feb 08, 2008 at 06:37:03AM +0100, Christian Couder wrote:
> 
> I think I was worried about something like this:
> 
> 1) ssh -Y other_machine
> 2) git help -w, it opens my browser
> 3) open many other tabs in the browser
> 4) exit other_machine, oops my browser with all my tabs is gone

It seems to me that the browser will be killed anyway if ssh connection
is closed. At least, that what happened when I used ssh -Y localhost. In
fact, "nohup" made only easier to kill the browser in this way:
ssh -Y localhost
git help -w
exit
CTRL-C

Without "nohup" CTRL-C had no effect, but when I started the browser
with nohup then the connection would be closed and the browser killed.


Dmitry

```

## Dmitry Potapov, 2008-02-08 20:36

Subject: [PATCH] remove "nohup" from git-help--browse
Message-ID: <1202502982-6822-1-git-send-email-dpotapov@gmail.com>
URL: https://gitlist.dev/e/1202502982-6822-1-git-send-email-dpotapov%40gmail.com
In-Reply-To: <7vhcgkm7yy.fsf@gitster.siamese.dyndns.org>

```
There is no good reason to run GUI browsers using "nohup". It does not
solve any real problem but creates annoying "nohup.out" files in every
directory where git help -w is run.

This patch removes "nohup" from git-help--browse.sh

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
---
It seems that everyone is agree that there is no good reason to
keep "nohup" in git-help--browse. So here is the patch.

 git-help--browse.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/git-help--browse.sh b/git-help--browse.sh
index 10b0a36..adc4d37 100755
--- a/git-help--browse.sh
+++ b/git-help--browse.sh
@@ -122,7 +122,7 @@ case "$browser" in
 	vers=$(expr "$($browser_path -version)" : '.* \([0-9][0-9]*\)\..*')
 	NEWTAB='-new-tab'
 	test "$vers" -lt 2 && NEWTAB=''
-	nohup "$browser_path" $NEWTAB $pages &
+	"$browser_path" $NEWTAB $pages &
 	;;
     konqueror)
 	case "$(basename "$browser_path")" in
@@ -136,7 +136,7 @@ case "$browser" in
 		eval "$browser_path" newTab $pages
 		;;
 	    *)
-	        nohup "$browser_path" $pages &
+	        "$browser_path" $pages &
 		;;
 	esac
 	;;
@@ -144,6 +144,6 @@ case "$browser" in
 	eval "$browser_path" $pages
 	;;
     dillo)
-	nohup "$browser_path" $pages &
+	"$browser_path" $pages &
 	;;
 esac
-- 
1.5.4

```

## Christian Couder, 2008-02-09 05:53

Subject: Re: [PATCH] remove "nohup" from git-help--browse
Message-ID: <200802090653.43280.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/200802090653.43280.chriscool%40tuxfamily.org
In-Reply-To: <1202502982-6822-1-git-send-email-dpotapov@gmail.com>

```
Le vendredi 8 février 2008, Dmitry Potapov a écrit :
> There is no good reason to run GUI browsers using "nohup". It does not
> solve any real problem but creates annoying "nohup.out" files in every
> directory where git help -w is run.

That's right, but if you just remove "nohup", then there may be some 
annoying browser output on the terminal. Perhaps we should also redirect 
stderr and stdout to /dev/null.

> This patch removes "nohup" from git-help--browse.sh

"git-help--browse.sh" has been renamed "git-web--browse.sh" in next so we 
need a similar patch for next.

Thanks,
Christian. 

```

## Dmitry Potapov, 2008-02-09 20:03

Subject: Re: [PATCH] remove "nohup" from git-help--browse
Message-ID: <20080209200351.GC30368@dpotapov.dyndns.org>
URL: https://gitlist.dev/e/20080209200351.GC30368%40dpotapov.dyndns.org
In-Reply-To: <200802090653.43280.chriscool@tuxfamily.org>

```
On Sat, Feb 09, 2008 at 06:53:43AM +0100, Christian Couder wrote:
> Le vendredi 8 février 2008, Dmitry Potapov a écrit :
> > There is no good reason to run GUI browsers using "nohup". It does not
> > solve any real problem but creates annoying "nohup.out" files in every
> > directory where git help -w is run.
> 
> That's right, but if you just remove "nohup", then there may be some 
> annoying browser output on the terminal. Perhaps we should also redirect 
> stderr and stdout to /dev/null.

I don't mind this redirection, but I am not sure whether it is the right
thing to do, because it may hide relevant error information, and if your
browser tends to print irrelevant and annoying messages at start, then
perhaps the script to start this browser should be corrected to suppress
these output.

So, I want to hear what other people think. If there is no objection,
I will add this redirection.

> 
> > This patch removes "nohup" from git-help--browse.sh
> 
> "git-help--browse.sh" has been renamed "git-web--browse.sh" in next so we 
> need a similar patch for next.

Okay, I will base my patch on next.


Dmitry

```

## Junio C Hamano, 2008-02-10 02:02

Subject: Re: [PATCH] remove "nohup" from git-help--browse
Message-ID: <7vbq6p7emn.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vbq6p7emn.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20080209200351.GC30368@dpotapov.dyndns.org>

```
Dmitry Potapov <dpotapov@gmail.com> writes:

> So, I want to hear what other people think. If there is no objection,
> I will add this redirection.

I personally feel that we should not hide output from the
backend browsers by redirection.  Some may be chattier than
others, but then we would know against which browser to file bug
reports.

Just my two yen.

```

## Johannes Schindelin, 2008-02-10 02:06

Subject: Re: [PATCH] remove "nohup" from git-help--browse
Message-ID: <alpine.LSU.1.00.0802100205440.11591@racer.site>
URL: https://gitlist.dev/e/alpine.LSU.1.00.0802100205440.11591%40racer.site
In-Reply-To: <7vbq6p7emn.fsf@gitster.siamese.dyndns.org>

```
Hi,

On Sat, 9 Feb 2008, Junio C Hamano wrote:

> Dmitry Potapov <dpotapov@gmail.com> writes:
> 
> > So, I want to hear what other people think. If there is no objection,
> > I will add this redirection.
> 
> I personally feel that we should not hide output from the
> backend browsers by redirection.  Some may be chattier than
> others, but then we would know against which browser to file bug
> reports.
> 
> Just my two yen.

Yeah.  If you do not like the chatty side, then there should be a way to 
configure a script which redirects stdout/stderr to be called in place of 
the browser binary.

Just my two (rapidly losing) pound.

Ciao,
Dscho

```
