kalarm/lib
ShellProcess Class Reference
#include <shellprocess.h>
Detailed Description
Enhanced KShellProcess.The ShellProcess class runs a shell command and interprets the shell exit status as far as possible. It blocks execution if shell access is prohibited. It buffers data written to the process's stdin.
Before executing any command, ShellProcess checks whether shell commands are allowed at all. If not (e.g. if the user is running in kiosk mode), it blocks execution.
Derived from KShellProcess, this class additionally tries to interpret the shell exit status. Different shells use different exit codes. Currently, if bash or ksh report that the command could not be found or could not be executed, the NOT_FOUND status is returned.
Writes to the process's stdin are buffered, so that unlike with KShellProcess, there is no need to wait for the write to complete before writing again.
- Author:
- David Jarvie <software@astrojar.org.uk>
Definition at line 50 of file shellprocess.h.
Public Types | |
enum | Status { INACTIVE, RUNNING, SUCCESS, UNAUTHORISED, DIED, NOT_FOUND, START_FAIL } |
Signals | |
void | shellExited (ShellProcess *) |
Public Member Functions | |
ShellProcess (const QString &command) | |
bool | start (Communication comm=NoCommunication) |
Status | status () const |
bool | normalExit () const |
const QString & | command () const |
QString | errorMessage () const |
void | writeStdin (const char *buffer, int bufflen) |
void | stdinExit () |
Static Public Member Functions | |
static bool | authorised () |
static const QCString & | shellName () |
static const QCString & | shellPath () |
Member Enumeration Documentation
|
Current status of the shell process.
Definition at line 63 of file shellprocess.h. |
Constructor & Destructor Documentation
|
Constructor.
Definition at line 40 of file shellprocess.cpp. |
Member Function Documentation
|
Returns whether the user is authorised to run shell commands. Shell commands may be prohibited in kiosk mode, for example. Definition at line 200 of file shellprocess.cpp. |
|
Returns the command configured to be run.
Definition at line 88 of file shellprocess.h. |
|
Returns the error message corresponding to the command exit status.
Definition at line 141 of file shellprocess.cpp. |
|
Returns whether the command was run successfully.
Definition at line 86 of file shellprocess.h. |
|
Signal emitted when the shell process execution completes. It is not emitted if start() did not attempt to start the command execution, e.g. in kiosk mode. |
|
Determines which shell to use.
Definition at line 105 of file shellprocess.h. |
|
Determines which shell to use.
Definition at line 165 of file shellprocess.cpp. |
|
Executes the configured command.
Definition at line 51 of file shellprocess.cpp. |
|
Returns the current status of the shell process.
Definition at line 82 of file shellprocess.h. |
|
Tell the process to exit once any outstanding STDIN strings have been written.
Definition at line 129 of file shellprocess.cpp. |
|
Writes a string to the process's STDIN.
Definition at line 102 of file shellprocess.cpp. |
The documentation for this class was generated from the following files: