Re: Processing Macros in background

From: Robert W. Hatcher <rhatcher_at_fnal.gov>
Date: Tue, 6 Jul 2010 11:38:25 -0500

On Jul 5, 2010, at 10:28 AM, Axel Naumann wrote:

> background processes cannot write to the TTY. If you have an idea
> (or a
> patch! :-) how to get it to work nevertheless then please let us know.

Sure they can. The problem is, for _some_ versions of ROOT, that there was some funny business going on where ROOT would try to _read_ some setting info about the TTY (which it can't do, being in the background).
This was related to the fancy changes to readline. This *has* been fixed
in recent versions of ROOT but for older ones (say around v5.26/00b) the backgrounded job goes into a "Stopped" state until it can get that initialization. The solution is to provide it with a stream of standard input:

On v5.27/02 and later:

    $ root -q -l Test.C &
works as expected.

On v5/26/00b I need to do:

    $ root -q -l Test.C < /dev/null &

-robert

> Cheers, Axel.
>
> Thomas Lauf wrote on 07/05/2010 04:59 PM:
>> Hello ROOTers,
>>
>> is there a way to process a ROOT macro in the background?
>>
>> Consider this simple macro Test.C:
>> {
>> cout << "Hello World" << endl;
>> }
>>
>> If I call ROOT to process it
>> ]> root -q -l Test.C
>>
>> in the shell I get the expected output:
>>
>> root [0]
>> Processing Test.C...
>> Hello World
>> ]>
>>
>> But if I want ROOT to process it in the background
>> I get no output until I fetch the process to foreground again
>> ]> root -q -l Test.C &
>> [4] 16584
>> ]> fg
>> root -q -l Test.C
>> root [0]
>> Processing Test.C...
>> Hello World
>> ]>
>>
>> Is there a way to make this work?
>>
>> The thing is I have a application (e.g. Prog1) which calls another
>> one
>> (e.g. Prog2) to do some calculation. Prog2 uses Rint as user
>> interface.
>> The call from Prog1 succeeds as long as it is run in foreground.
>> If run
>> in the background I run into the same problem as shown above.
>>
>> Regards
>>
>> Thomas Lauf
>>
>>
>

Robert W. Hatcher | rhatcher_at_fnal.gov 630-840-3102 FNAL CD/REX (MINOS) | MS 220, PO Box 500, Batavia IL 60510 Received on Tue Jul 06 2010 - 18:38:44 CEST

This archive was generated by hypermail 2.2.0 : Tue Jul 06 2010 - 23:50:01 CEST