MeVisLab Scripting Reference
MLABProcess Class Reference

Inherits QProcess, and QObject.

Inherited by MLABOutputDiscardingProcess, and MLABOutputRecordingProcess.

Public Slots

Script access


void addArgument (const QString &arg)
 
void addArguments (const QStringList &args)
 
void clearArguments ()
 
void setArgs (const QString &cmd, const QString &args)
 
void setWorkDir (const QString &wd)
 
void setStdOutHandler (MLABModule *mod, const QString &script)
 
void setStdErrHandler (MLABModule *mod, const QString &script)
 
void setExitedHandler (MLABModule *mod, const QString &script)
 
void setLaunchFinishedHandler (MLABModule *mod, const QString &script)
 
bool run (const QString &stdinput)
 
bool run ()
 
void waitForLaunch ()
 
void waitForExit ()
 
bool normalExit ()
 
bool isRunning ()
 
bool launchFinished ()
 
void setUserInfo (const QString &info)
 
QString userInfo ()
 
QString readStdOut ()
 
QString readStdErr ()
 
QString readLineStdOut ()
 
QString readLineStdErr ()
 
int exitStatus ()
 
void kill ()
 
qint64 processId ()
 

Detailed Description

MLABProcess object available via MLAB.

The MLABProcess object can be used to have full control of started processes. For simpler functions, see MLAB API.

Note that the process object behaves differently on different platforms!

binary = MLABFileManager.getExecutable("MeVisLab")
p.addArgument(binary)
p.addArgument("-unique")
p.setLaunchFinishedHandler(ctx, "launchFinished")
p.setExitedHandler(ctx, "exited")
p.setStdOutHandler(ctx, "stdOut")
p.setStdErrHandler(ctx, "stdErr")
p.run()
Global MLABFileManager object available in all scripts.
Definition: mlabScriptWrappers.h:248
QString getExecutable(const QString &name)
Returns the absolute path of the given executable (where name is given without debug and file extensi...
Access to all global functions and objects of MLAB.
Definition: mlabGlobalScriptAccess.h:81
MLABScriptProcess * newProcess()
Creates a new process, see MLABProcess class for its API.
// Example handler:
def stdOut(p):
QString readLineStdOut()
Returns one line of std output.

Member Function Documentation

◆ addArgument

void MLABProcess::addArgument ( const QString &  arg)
slot

Adds an argument, first argument added is the called program.

◆ addArguments

void MLABProcess::addArguments ( const QStringList &  args)
slot

Adds an argument list, first argument is the called program.

◆ clearArguments

void MLABProcess::clearArguments ( )
slot

Clears the arguments.

◆ exitStatus

int MLABProcess::exitStatus ( )
inlineslot

Returns the exit status of the process.

◆ isRunning

bool MLABProcess::isRunning ( )
slot

Returns whether the process is currently running.

◆ kill

void MLABProcess::kill ( )
inlineslot

Kills the running process (more than just deleting the MLABProcess, it really kills the running process!).

◆ launchFinished

bool MLABProcess::launchFinished ( )
inlineslot

Returns whether the launch is finished (it's safe to delete the process afterwards).

◆ normalExit

bool MLABProcess::normalExit ( )
slot

Returns whether the process exited normally, i.e. didn't crash.

◆ processId

qint64 MLABProcess::processId ( )
inlineslot

Return process ID of process.

◆ readLineStdErr

QString MLABProcess::readLineStdErr ( )
slot

Returns one line of error output.

◆ readLineStdOut

QString MLABProcess::readLineStdOut ( )
slot

Returns one line of std output.

◆ readStdErr

QString MLABProcess::readStdErr ( )
slot

Returns the whole output currently available, does not return the same output a second time!

◆ readStdOut

QString MLABProcess::readStdOut ( )
slot

Returns the whole output currently available, does not return the same output a second time!

◆ run [1/2]

bool MLABProcess::run ( )
slot

Runs the process.

◆ run [2/2]

bool MLABProcess::run ( const QString &  stdinput)
slot

Runs the process with given std in.

◆ setArgs

void MLABProcess::setArgs ( const QString &  cmd,
const QString &  args 
)
slot

Sets the command and the arguments, arguments are split by spaces, so this format does NOT support argument entries which contain spaces, you have to use the addArguments() method instead.

◆ setExitedHandler

void MLABProcess::setExitedHandler ( MLABModule mod,
const QString &  script 
)
slot

Sets a handler that is called when the process exited.

◆ setLaunchFinishedHandler

void MLABProcess::setLaunchFinishedHandler ( MLABModule mod,
const QString &  script 
)
slot

Sets a handler that is called when the process launch (and stdin args passing) is complete.

◆ setStdErrHandler

void MLABProcess::setStdErrHandler ( MLABModule mod,
const QString &  script 
)
slot

Sets a handler that is called when new output is available.

◆ setStdOutHandler

void MLABProcess::setStdOutHandler ( MLABModule mod,
const QString &  script 
)
slot

Sets a handler that is called when new output is available.

◆ setUserInfo

void MLABProcess::setUserInfo ( const QString &  info)
inlineslot

Sets user information for this process.

◆ setWorkDir

void MLABProcess::setWorkDir ( const QString &  wd)
slot

Sets the work directory.

◆ userInfo

QString MLABProcess::userInfo ( )
inlineslot

Returns user information for this process.

◆ waitForExit

void MLABProcess::waitForExit ( )
slot

Waits until the running process exits.

◆ waitForLaunch

void MLABProcess::waitForLaunch ( )
slot

Waits until the process is completely launched (before it is not safe to delete the process!).