OpendTect-6_4  6.4
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | List of all members
OS::CommandLauncher Class Reference

Launches machine commands. More...

Public Member Functions

 CommandLauncher (const MachineCommand &)
 
 CommandLauncher (const MachineCommand &, bool isolated)
 
 ~CommandLauncher ()
 
void set (const MachineCommand &)
 
void set (const MachineCommand &, bool isolated)
 
bool execute (BufferString &output_stdout, BufferString *output_stderr=0)
 run &, wait until finished, catch output More...
 
bool execute (const CommandExecPars &pars=CommandExecPars())
 
int processID () const
 
const char * monitorFileName () const
 
uiString errorMsg () const
 
od_istreamgetStdOutput ()
 
od_istreamgetStdError ()
 
od_ostreamgetStdInput ()
 

Static Public Member Functions

static void addShellIfNeeded (BufferString &cmd)
 
static void addQuotesIfNeeded (BufferString &cmd)
 
static void manageQProcess (QProcess *)
 

Protected Member Functions

void reset ()
 
bool doExecute (const char *comm, bool wait4finish, bool inconsole=false, bool createstreams=false)
 
int catchError ()
 
bool startDetached (const char *, bool inconsole=false)
 

Protected Attributes

MachineCommand machcmd_
 
BufferString monitorfnm_
 
bool redirectoutput_
 
BufferString progvwrcmd_
 
uiString errmsg_
 
const BufferString odprogressviewer_
 
QProcess * process_
 
int64_t pid_
 
od_istreamstdoutput_
 
od_istreamstderror_
 
od_ostreamstdinput_
 
qstreambufstdoutputbuf_
 
qstreambufstderrorbuf_
 
qstreambufstdinputbuf_
 

Private Member Functions

void setIsolated ()
 

Static Private Member Functions

static uiString tr (const char *text, const char *disambiguation=0, int pluralnr=-1)
 
static uiString legacyTr (const char *text, const char *disambiguation=0, int pluralnr=-1)
 

Detailed Description

Launches machine commands.

Constructor & Destructor Documentation

OS::CommandLauncher::CommandLauncher ( const MachineCommand )
OS::CommandLauncher::CommandLauncher ( const MachineCommand ,
bool  isolated 
)
OS::CommandLauncher::~CommandLauncher ( )

Member Function Documentation

static void OS::CommandLauncher::addQuotesIfNeeded ( BufferString cmd)
static

Checks for spaces in command, and surrounds command with quotes them if not already done.

static void OS::CommandLauncher::addShellIfNeeded ( BufferString cmd)
static

Analyses the cmd and looks for pipes or redirects. If these are found, the cmd is converted to a shell command.

int OS::CommandLauncher::catchError ( )
protected
bool OS::CommandLauncher::doExecute ( const char *  comm,
bool  wait4finish,
bool  inconsole = false,
bool  createstreams = false 
)
protected
uiString OS::CommandLauncher::errorMsg ( ) const
inline
bool OS::CommandLauncher::execute ( BufferString output_stdout,
BufferString output_stderr = 0 
)

run &, wait until finished, catch output

bool OS::CommandLauncher::execute ( const CommandExecPars pars = CommandExecPars())
od_istream* OS::CommandLauncher::getStdError ( )
inline
od_ostream* OS::CommandLauncher::getStdInput ( )
inline
od_istream* OS::CommandLauncher::getStdOutput ( )
inline
static uiString OS::CommandLauncher::legacyTr ( const char *  text,
const char *  disambiguation = 0,
int  pluralnr = -1 
)
inlinestaticprivate
static void OS::CommandLauncher::manageQProcess ( QProcess *  )
static

Add a QProcess and it will be deleted one day.

const char* OS::CommandLauncher::monitorFileName ( ) const
inline
int OS::CommandLauncher::processID ( ) const
void OS::CommandLauncher::reset ( )
protected
void OS::CommandLauncher::set ( const MachineCommand )
void OS::CommandLauncher::set ( const MachineCommand ,
bool  isolated 
)
void OS::CommandLauncher::setIsolated ( )
private
bool OS::CommandLauncher::startDetached ( const char *  ,
bool  inconsole = false 
)
protected
static uiString OS::CommandLauncher::tr ( const char *  text,
const char *  disambiguation = 0,
int  pluralnr = -1 
)
inlinestaticprivate

Member Data Documentation

uiString OS::CommandLauncher::errmsg_
protected
MachineCommand OS::CommandLauncher::machcmd_
protected
BufferString OS::CommandLauncher::monitorfnm_
protected
const BufferString OS::CommandLauncher::odprogressviewer_
protected
int64_t OS::CommandLauncher::pid_
protected
QProcess* OS::CommandLauncher::process_
protected
BufferString OS::CommandLauncher::progvwrcmd_
protected
bool OS::CommandLauncher::redirectoutput_
protected
od_istream* OS::CommandLauncher::stderror_
protected
qstreambuf* OS::CommandLauncher::stderrorbuf_
protected
od_ostream* OS::CommandLauncher::stdinput_
protected
qstreambuf* OS::CommandLauncher::stdinputbuf_
protected
od_istream* OS::CommandLauncher::stdoutput_
protected
qstreambuf* OS::CommandLauncher::stdoutputbuf_
protected

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019