Skip to contentSkip to conversation

git help -w should not create nohup.out

PATCH In review Dmitry Potapov 4 participants 11 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git help -w should not create nohup.out

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.

---

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(-)
git-help--browse.sh +3 -3
index 10b0a36..320e836 100755
@@ -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
Signature · 1 line
1.5.4
#1 lore raw

Hi,

Quoted 1 line · Dmitry Potapov

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

#2 lore raw
Quoted 11 lines · Johannes Schindelin

Hi,

Quoted 1 line · Dmitry Potapov

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.

#3 lore raw

PATCH 1/1 remove "nohup" from git-help--browse

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

---
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(-)
git-help--browse.sh +3 -3
index 10b0a36..adc4d37 100755
@@ -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
Signature · 1 line
1.5.4
#8 lore raw
In reply to Junio C Hamano
Quoted 6 lines · Junio C Hamano
Quoted 5 lines · Johannes Schindelin

Hi,

Quoted 1 line · Dmitry Potapov

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

Quoted 8 lines
Quoted 6 lines

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.

#9 lore raw
Quoted 7 lines · Christian Couder

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

#10 lore raw
In reply to Junio C Hamano
Quoted 19 lines · Junio C Hamano
Quoted 11 lines · Johannes Schindelin

Hi,

Quoted 1 line · Dmitry Potapov

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;

Quoted 8 lines

(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

#4 lore raw

Re: [PATCH] remove "nohup" from git-help--browse

In reply to Dmitry Potapov
Quoted 3 lines · Dmitry Potapov

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.

Quoted 1 line

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.

#5 lore raw

Re: [PATCH] remove "nohup" from git-help--browse

Quoted 8 lines · Christian Couder
Quoted 3 lines · Dmitry Potapov

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.

Quoted 5 lines
Quoted 2 lines

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

#6 lore raw

Re: [PATCH] remove "nohup" from git-help--browse

Quoted 2 lines · Dmitry Potapov

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.

#7 lore raw

Re: [PATCH] remove "nohup" from git-help--browse

Hi,

Quoted 11 lines · Junio C Hamano
Quoted 2 lines · Dmitry Potapov

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