#include <klfblockprocess.h>
Public Slots | |
| bool | startProcess (QStringList cmd, QByteArray stdindata, QStringList env=QStringList()) |
| bool | startProcess (QStringList cmd, QCString str, QStringList env=QStringList()) |
| bool | startProcess (QStringList cmd, QStringList env=QStringList()) |
| QString | readStdoutString () |
| QString | readStderrString () |
Public Member Functions | |
| KLFBlockProcess (QObject *parent=0) | |
| ~KLFBlockProcess () | |
| QByteArray | getAllStderr () |
| QByteArray | getAllStdout () |
A Code-blocking (but not GUI-blocking) process executor
Use for example like:
KLFBlockProcess proc; QStringList args; args << "ls" << "/dev"; proc.startProcess(args); QString alldevices = proc.readStdoutString();
This class provides functionality for passing data to STDIN and getting data from STDOUT and STDERR afterwards.
Definition at line 56 of file klfblockprocess.h.
|
|
Normal constructor, like QProcess constructor Definition at line 29 of file klfblockprocess.cpp. |
|
|
Normal destructor Definition at line 40 of file klfblockprocess.cpp. |
|
|
Returns all standard error output as a QByteArray. This function is to standardize the readStderr() and readAllStandardError() functions in QT 3 or QT 4 respectively Definition at line 67 of file klfblockprocess.h. |
|
|
Returns all standard output as a QByteArray. This function is to standardize the readStdout() and readAllStandardOutput() functions in QT 3 or QT 4 respectively Definition at line 77 of file klfblockprocess.h. |
|
||||||||||||||||
|
Starts cmd (which is a list of arguments, the first being the program itself) and blocks until process stopped. The QT event loop is updated regularly so that the GUI doesn't freeze. Read result with QProcess::readStdout() and QProcess::readStderr(), get process exit info with QProcess::normalExit() and QProcess::exitStatus().
Definition at line 66 of file klfblockprocess.cpp. Referenced by startProcess(). |
|
||||||||||||||||
|
Convenient function if you want to pass string input to program This mostly truncates the last '\0' because programs don't like it.
Definition at line 56 of file klfblockprocess.cpp. References startProcess(). |
|
||||||||||||
|
Convenient function to be used in the case where program doesn't expect stdin data or if you chose to directly close stdin without writing anything to it. Definition at line 61 of file klfblockprocess.cpp. References startProcess(). |
|
|
Like QProcess::readStdout(), except returns a QString instead of a QByteArray Definition at line 131 of file klfblockprocess.h. |
|
|
Like QProcess::readStderr(), except returns a QString instead of a QByteArray Definition at line 139 of file klfblockprocess.h. |
1.4.6