![]() |
OpendTect
7.0
|
Encapsulates an actual command to execute + the machine to run it on. More...
Public Member Functions | |
| MachineCommand (const char *prognm, bool isolated) | |
| MachineCommand (const char *prognm, const BufferStringSet &arguments) | |
| MachineCommand (const char *prognm, const char *arg1, const char *arg2=0, const char *arg3=0, const char *arg4=0, const char *arg5=0) | |
| MachineCommand (const char *prognm=nullptr) | |
| MachineCommand (const MachineCommand &, bool isolated) | |
| MachineCommand & | addArg (const char *) |
| template<class T > | |
| MachineCommand & | addArg (const T &t) |
| MachineCommand & | addArgs (const BufferStringSet &) |
| MachineCommand & | addFileRedirect (const char *fnm, int stdcode=0, bool append=false) |
| MachineCommand & | addFlag (const char *flg, KeyStyle ks=NewStyle) |
| MachineCommand & | addKeyedArg (const char *ky, const char *valstr, KeyStyle ks=NewStyle) |
| template<class T > | |
| MachineCommand & | addKeyedArg (const char *ky, const T &t, KeyStyle ks=NewStyle) |
| MachineCommand & | addPipe () |
| const BufferStringSet & | args () const |
| bool | execute (BufferString &output_stdout, BufferString *output_stderr=nullptr, const char *workdir=nullptr) |
| run &, wait until finished, catch output More... | |
| bool | execute (const CommandExecPars &) |
| bool | execute (LaunchType lt=Wait4Finish, const char *workdir=nullptr) |
| bool | hasHostName () const |
| bool | hostIsWindows () const |
| const char * | hostName () const |
| bool | isBad () const |
| const char * | program () const |
| const char * | remExec () const |
| BufferString | runAndCollectOutput (BufferString *errmsg=nullptr) |
| for quick get-me-the-output-of-this-command More... | |
| MachineCommand & | setHostIsWindows (bool yn) |
| MachineCommand & | setHostName (const char *) |
| MachineCommand & | setProgram (const char *pn) |
| MachineCommand & | setRemExec (const char *sh) |
| BufferString | toString (const CommandExecPars *=nullptr) const |
| Only for messaging purposes. More... | |
Static Public Member Functions | |
| static const char * | defaultRemExec () |
| static const char * | getIsolationScriptFnm () |
| static const char * | odRemExecCmd () |
| static void | setDefaultRemExec (const char *s) |
| static void | setIsolationScript (const char *) |
| static const char * | sKeyIsolationScript () |
| static const char * | sKeyJobID () |
| static const char * | sKeyMasterHost () |
| static const char * | sKeyMasterPort () |
| static const char * | sKeyPrimaryHost () |
| static const char * | sKeyPrimaryPort () |
| static const char * | sKeyRemoteCmd () |
| static const char * | sKeyRemoteHost () |
Private Member Functions | |
| void | addShellIfNeeded () |
| MachineCommand | getExecCommand (const CommandExecPars *=nullptr) const |
| void | setIsolated (const char *prognm) |
Private Attributes | |
| BufferStringSet | args_ |
| BufferString | hname_ |
| bool | hostiswin_ = false |
| bool | needshell_ = false |
| BufferString | prognm_ |
| BufferString | remexec_ = defremexec_ |
Static Private Attributes | |
| static BufferString | defremexec_ |
Friends | |
| class | ::StreamProvider |
| class | CommandLauncher |
Encapsulates an actual command to execute + the machine to run it on.
The default remote execution command is ssh.
<>
|
inline |
|
inline |
| OS::MachineCommand::MachineCommand | ( | const char * | prognm, |
| const char * | arg1, | ||
| const char * | arg2 = 0, |
||
| const char * | arg3 = 0, |
||
| const char * | arg4 = 0, |
||
| const char * | arg5 = 0 |
||
| ) |
| OS::MachineCommand::MachineCommand | ( | const char * | prognm, |
| bool | isolated | ||
| ) |
| OS::MachineCommand::MachineCommand | ( | const MachineCommand & | , |
| bool | isolated | ||
| ) |
| MachineCommand& OS::MachineCommand::addArg | ( | const char * | ) |
|
inline |
| MachineCommand& OS::MachineCommand::addArgs | ( | const BufferStringSet & | ) |
| MachineCommand& OS::MachineCommand::addFileRedirect | ( | const char * | fnm, |
| int | stdcode = 0, |
||
| bool | append = false |
||
| ) |
stdcode=0: '>'; stdcode=1: '1>'; stdcode=2: '2>' stdcode=3: '> fnm 2>&1'; append: '>>'; otherwise: '>'
|
inline |
| MachineCommand& OS::MachineCommand::addKeyedArg | ( | const char * | ky, |
| const char * | valstr, | ||
| KeyStyle | ks = NewStyle |
||
| ) |
|
inline |
|
inline |
|
private |
Analyses the cmd and looks for pipes or redirects. If these are found, the cmd is converted to a shell command.
|
inline |
|
inlinestatic |
| bool OS::MachineCommand::execute | ( | BufferString & | output_stdout, |
| BufferString * | output_stderr = nullptr, |
||
| const char * | workdir = nullptr |
||
| ) |
run &, wait until finished, catch output
| bool OS::MachineCommand::execute | ( | const CommandExecPars & | ) |
| bool OS::MachineCommand::execute | ( | LaunchType | lt = Wait4Finish, |
| const char * | workdir = nullptr |
||
| ) |
|
private |
|
static |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inline |
|
inline |
| BufferString OS::MachineCommand::runAndCollectOutput | ( | BufferString * | errmsg = nullptr | ) |
for quick get-me-the-output-of-this-command
|
inlinestatic |
| MachineCommand& OS::MachineCommand::setHostIsWindows | ( | bool | yn | ) |
| MachineCommand& OS::MachineCommand::setHostName | ( | const char * | ) |
|
private |
|
static |
|
inline |
| MachineCommand& OS::MachineCommand::setRemExec | ( | const char * | sh | ) |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
| BufferString OS::MachineCommand::toString | ( | const CommandExecPars * | = nullptr | ) | const |
Only for messaging purposes.
|
friend |
|
friend |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024