[Fwd: Re: Processing Macros in background]

From: Jacques Goldberg <Jacques.Goldberg_at_cern.ch>
Date: Mon, 5 Jul 2010 19:47:22 +0300


Thomas,

That's not a ROOT issue, but your background program can be submitted with a redirection to some file and that file can be displayed on the fly in an other window using the Unix/Linux command tail with the   -f option.

This assumes that what you wish to display is always text.

The redirection is the simplest way to write to a file. You can also replace cout in your example by the arbitrary name of a file handle defined by an iostream. Excuse me for writing possibly trivial material, depending on your knowledge of C++, but combining the example at:

http://www.cplusplus.com/doc/tutorial/files/ in your ROOT script with, in an other window,

tail -f example.txt

seems like exactly what you are looking for - if I undesrtood correctly the query.

Jacques

Axel Naumann wrote:

> Hi Thomas,
>
> 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.
>
> 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
>>
>>
>>
>
>
Received on Mon Jul 05 2010 - 18:47:30 CEST

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