Bug 38893

Summary: ant has problems with nohup
Product: Ant Reporter: Bjoern Teipel <bt>
Component: CoreAssignee: Ant Notifications List <notifications>
Status: RESOLVED DUPLICATE    
Severity: major CC: jglick
Priority: P2    
Version: 1.6.5   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Bjoern Teipel 2006-03-08 17:05:46 UTC
Hello,

we are running several ant tasks under various OS like Linux 2.6, Solaris 9/10
(X86_64/Sparc), HP UX and under all OS ant 1.6.5 has problems when running with
nohup command.

Nohup is an old *nix command which catches the SIGTERM signal while you are
running a program and it's writing a logfile from STDOUT to nohup.out.
So far so good, but if we run a ant task which takes several hours to complete
and we don't wan't to wait until this job is finished, we just close our SSH
terminal and the job normally keeps going. This is the normal behavior with ant
1.6.2 but at ant 1.6.5, task are halting suddenly if we close a terminal and on
the different terminal we can see that unix processes still exists, but doing
nothing.

This is alway reproducible and if we switch back to ant 1.6.2 everything is
working fine, the environment hasn't changed meanwhile.
Comment 1 Dominique Devienne 2006-03-08 22:04:40 UTC
Did you try running Ant with -noinput? This may help with nohup. --DD
Comment 2 Bjoern Teipel 2006-03-09 07:26:47 UTC
No i didn't try this parameter.
I'll test it and will come back later.
Comment 3 Alexey Solofnenko 2006-03-09 16:31:02 UTC
You need to redirect all standard handles to /dev/null:

nohup ant ....... >/dev/null 2>/dev/null </dev/null&
Comment 4 Bjoern Teipel 2006-03-09 16:33:53 UTC
Why should i do this, it wasn't necessary at version 1.6.2 ?
If I'm doing this way, all log information which is beeing written to STDOUT is
lost.
Comment 5 Alexey Solofnenko 2006-03-09 16:37:05 UTC
I would think you changed Java version as well. In order to preserve output do
the following:

nohup ant ... >build.log 2>&1 </dev/null&
tail -f build.log

Or maybe 2>&1 should be before >build.log - I always forget how it implemented.
Comment 6 Bjoern Teipel 2006-03-20 13:56:16 UTC
-noinput seems to solve the problem with nohup.
What has changed from ant 1.6.2 to 1.6.5 that this parameter must be set ?
It's really annoying to type always -noinput, the command lines already long
enough... ;-)
Comment 7 Dominique Devienne 2006-03-20 15:42:48 UTC
Ant recently added the ability to do input. Before this was done, Ant never did 
any input, so the problem never occured. -noinput allows to get that this older 
beahvior. Glad to hear it works for you. --DD

PS: I would guess </dev/null should also work, but I'm not sure.
Comment 8 Stefan Bodewig 2008-08-20 08:04:49 UTC

*** This bug has been marked as a duplicate of bug 34461 ***