RE: Inquiry about portable GUI and scripting

From: Bertrand Bellenot <Bertrand.Bellenot_at_cern.ch>
Date: Mon, 22 Jan 2007 09:20:00 +0100


Hello Tom,

  1. Here is one way to redirect stdout/stderr (as used in TSessionViewer):

   TString pathtmp = Form("%s/anyfile", gSystem->TempDirectory());
// redirect stdout/stderr to temp file
   if (gSystem->RedirectOutput(pathtmp.Data(), opt) != 0) {

      Error("ShowStatus", "stdout/stderr redirection failed; skipping");    }
// execute command line

   gApplication->ProcessLine(cmd);
// restore back stdout/stderr

   if (gSystem->RedirectOutput(0) != 0) {

      Error("ShowStatus", "stdout/stderr retore failed; skipping");    }
// if check box "clear view" is checked, clear text view
   if (fClearCheck->IsOn())

      fInfoTextView->Clear();
// load (display) temp file in text view
   fInfoTextView->LoadFile(pathtmp.Data());

2) There is no simple solution...
Plese take a look at the attached file (KillProcByName), it may help (it is pure Win32 code).

3) To hide the command prompt on Windows, please take a look at this page:
http://root.cern.ch/root/HowtoWindows.html

Cheers,
Bertrand.

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch
[mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Tom Roberts Sent: Monday, January 22, 2007 12:16 AM
To: roottalk_at_pcroot.cern.ch
Subject: Re: [ROOT] Inquiry about portable GUI and scripting

I have spent an hour or two playing with this, and have a reasonable first attempt. It has a TGTextEntry to enter a command, a Run button, and uses a TThread to copy stdout of the command to a TGTextView -- that is most of what I need. Eventually I'll make it find my executable and setup its environment (what I need the portable scripting to do).

Two limitations:

  1. I would like to have a pipe both to stdin and from stdout of the command. TSystem::OpenPipe() cannot do that (indeed, the usual popen(3) cannot do it). I can work around this.
  2. How do I kill the command (running from OpenPipe() or Exec())? This I absolutely need. On Linux and MacOS I know what to do; what do I do on Windows? My program must be compiled (ACLiC), and I am willing to use #ifdef WIN32, but don't know what to put there....

And a question: Is there a way to suppress or hide the stdin/stdout/terminalWindow of Root? It is likely to confuse some users....

Tom Roberts Received on Mon Jan 22 2007 - 09:20:10 CET

This archive was generated by hypermail 2.2.0 : Mon Jan 22 2007 - 17:50:00 CET