TApplication in batch mode

Hello all,

please excuse me if this information is available somewhere, but I seem to incapable of finding it. I am usually running programs “outside” ROOT in Linux like:

test.cc:

#include <iostream>

#include "TApplication.h"
#include "TCanvas.h"

int main(int argc, char**argv)
{
  TApplication *app = new TApplication("app",&argc,argv);

  // Just to do something...
  TCanvas *c1 = new TCanvas("c1","c1",950,950);

  app->Run();

  return 0;
}

And I can compile it, run it, I have the window opened and everything’s fine. The problem now, comes from when I want to run it in batch mode using the option ‘-b’ like
./test -b

So no window is opened and things goes well, but it still hangs in the Run() part, and I have to leave it with ^C.

Is that expected? Is there any option that would disable the hanging in Run()? Shouldn’t the bash option also disable that?

Thank you,
Tudi.

Whe using TApplication, we assume that you control yourself the event loop.
In your case use TRint (it is a TApplication) as shown below and run

myapp -b -q
Rene

[code]
#include

#include “TRint.h”
#include “TCanvas.h”

int main(int argc, char**argv)
{
TRint *app = new TRint(“app”,&argc,argv);

// Just to do something…
TCanvas *c1 = new TCanvas(“c1”,“c1”,950,950);

app->Run();

return 0;
} [/code]

Alright, thanks for your answer.

Dear Rene and Tudi,

I have exactly the same issue. The difference is that my program receives already some arguments. When I introduce -b and -q in the argument line, argc and arg are modifed. I can skip this somehow by copying the arguments somewhere else before instantiating TRint, but could it be done in an elegant way?

Thanks,
Javier