Public Slots | |
Script access | |
| void | addArgument (const QString &arg) |
| void | addArguments (const QStringList &args) |
| void | clearArguments () |
| int | exitStatus () |
| bool | isRunning () |
| void | kill () |
| bool | launchFinished () |
| bool | normalExit () |
| QString | readLineStdErr () |
| QString | readLineStdOut () |
| QString | readStdErr () |
| QString | readStdOut () |
| bool | run () |
| bool | run (const QString &stdinput) |
| void | setArgs (const QString &cmd, const QString &args) |
| void | setExitedHandler (MLABModule *mod, const QString &script) |
| void | setLaunchFinishedHandler (MLABModule *mod, const QString &script) |
| void | setStdErrHandler (MLABModule *mod, const QString &script) |
| void | setStdOutHandler (MLABModule *mod, const QString &script) |
| void | setUserInfo (const QString &info) |
| void | setWorkDir (const QString &wd) |
| QString | userInfo () |
| void | waitForExit () |
| void | waitForLaunch () |
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!
p = MLAB.newProcess(); var binary = MLABFileManager.getExecutable("MeVisLab"); if (MLAB.isWindows()) { binary += (MLAB.isDebug()?"_d.exe":".exe"); } p.addArgument(binary); p.addArgument("-unique"); p.setLaunchFinishedHandler(ctx, "launchFinished"); p.setExitedHandler(ctx, "exited"); p.setStdOutHandler(ctx, "stdOut"); p.setStdErrHandler(ctx, "stdErr"); p.run();
// Example handler: function stdOut(p) { MLAB.log(p.readLineOut()); }
| void MLABProcess::addArgument | ( | const QString & | arg | ) | [slot] |
add an argument, first argument added is the called program
| void MLABProcess::addArguments | ( | const QStringList & | args | ) | [slot] |
add an argument list, first argument is the called program
| void MLABProcess::clearArguments | ( | ) | [slot] |
clear the arguments
| int MLABProcess::exitStatus | ( | ) | [inline, slot] |
exit status of process
| bool MLABProcess::isRunning | ( | ) | [slot] |
returns if the process in currently running
| void MLABProcess::kill | ( | ) | [inline, slot] |
kill the running process (more than just deleting the MLABProcess, it really kill the running process!)
| bool MLABProcess::launchFinished | ( | ) | [inline, slot] |
returns if the launch is finished (it's safe to delete the process afterwards)
| bool MLABProcess::normalExit | ( | ) | [slot] |
returns if the process exited normally, i.e. didn't crash
| QString MLABProcess::readLineStdErr | ( | ) | [slot] |
returns one line of error output
| QString MLABProcess::readLineStdOut | ( | ) | [slot] |
returns one line of std output
| QString MLABProcess::readStdErr | ( | ) | [slot] |
returns the whole output currently available, does not return the same output a second time!
| QString MLABProcess::readStdOut | ( | ) | [slot] |
returns the whole output currently available, does not return the same output a second time!
| bool MLABProcess::run | ( | ) | [slot] |
run the process
| bool MLABProcess::run | ( | const QString & | stdinput | ) | [slot] |
run the process with given std in
| void MLABProcess::setArgs | ( | const QString & | cmd, | |
| const QString & | args | |||
| ) | [slot] |
sets the command and the arguments, arguments are splitted by spaces, so this format does NOT support argument entries which contain spaces, you have to use the addArguments() method instead
| void MLABProcess::setExitedHandler | ( | MLABModule * | mod, | |
| const QString & | script | |||
| ) | [slot] |
set handler that is called when the process exited
| void MLABProcess::setLaunchFinishedHandler | ( | MLABModule * | mod, | |
| const QString & | script | |||
| ) | [slot] |
set handler that is called when the process launch (and stdin args passing) is complete
| void MLABProcess::setStdErrHandler | ( | MLABModule * | mod, | |
| const QString & | script | |||
| ) | [slot] |
set handler that is called when new output is available
| void MLABProcess::setStdOutHandler | ( | MLABModule * | mod, | |
| const QString & | script | |||
| ) | [slot] |
set handler that is called when new output is available
| void MLABProcess::setUserInfo | ( | const QString & | info | ) | [inline, slot] |
set user info for this process
| void MLABProcess::setWorkDir | ( | const QString & | wd | ) | [slot] |
set the work dir
| QString MLABProcess::userInfo | ( | ) | [inline, slot] |
get user info for this process
| void MLABProcess::waitForExit | ( | ) | [slot] |
wait until the running process exits
| void MLABProcess::waitForLaunch | ( | ) | [slot] |
wait until the process is completely launched (before it is not safe to delete the process!)
1.5.8