[ROOT-7053] Prompt redirection does not redirect Created: 30/Jan/15  Updated: 10/Aug/15  Resolved: 10/Aug/15

Status: Closed
Project: ROOT
Component/s: Cling
Affects Version/s: 6.02/04
Fix Version/s: 6.04.00, 6.02/08

Type: Bug Priority: High
Reporter: Axel Naumann Assignee: Axel Naumann
Resolution: Fixed Votes: 0
Labels: None
Environment:

Any


Development:

 Description   

In ROOT 5, .> also redirected stdout of user code. This has changed. Test case:

$ cat hello.C
void hello() {
   cout << "Hello!" << endl;
   return;
}
$ root -l -b
root [0] .> aa.log
root [1] .x hello.C
Hello!

In ROOT 5, "Hello!" ends up in aa.log:

$ root -l -b
root [0] .x hello.C > aa.log
root [1]



 Comments   
Comment by Philippe Canal [ 11/Feb/15 ]

Hi,

The problem seems to be limited to the .x case:

$ root.exe -b -l
root [0] .> /tmp/aa.log
root [1] .L /tmp/a.C
root [2] a()
root [3] .> 
root [4] .! cat /tmp/aa.log
Hello!

Cheers,
Philippe.

Comment by Elissavet Sakellari (Inactive) [ 16/Apr/15 ]

Fixed for the master and the v6-02-00-patches.

Comment by Lorenzo Moneta [ 28/Jul/15 ]

There is still a problem when using TTree::Scan. One needs to issue the command two times.
See https://root.cern.ch/phpBB3/viewtopic.php?f=3&t=19111#p86190
or not use automatic reading of the object.
Is this issue similar to the one observed in TFormula,
see ROOT-7512.

Example not working:

.x $ROOTSYS/tutorials/hsimple.C
TFile f("hsimple.root")
.> a.log
ntuple->Scan("px:py:pz")
.>

Instead this is working

TFile f("hsimple.root");
auto ntuple = (TTree*) f.Get("ntuple");
ntuple->Scan("px:py:pz");
.> a.log
ntuple->Scan("px:py:pz");
.>

Comment by Elissavet Sakellari (Inactive) [ 10/Aug/15 ]

Fixed on the following branches:
Branch :master
Commit :5e789f4e9dc15b01ad39e6cbb0345572c7e11d48

Branch :v6-04-00-patches
Commit :4275398a1d4182a90c20d8a69600ccbe71bd4927

Branch: v6-02-00-patches
Commit: c1d7cd77d9b13ef23285d3a60dcb160db567b846

Generated at Sat Sep 21 06:55:51 CEST 2019 using Jira 7.13.1#713001-sha1:5e06076c2d215a6f699b7e5c90ab2fae7ba5a1ce.