KDE PIM / Developers / API Docs / kalarm

ShellProcess Class Reference

Enhanced KShellProcess. More...

#include <shellprocess.h>

Inherits KShellProcess.

List of all members.

Public Types

Signals

Public Member Functions

Static Public Member Functions


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.

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.

Author:
David Jarvie <software@astrojar.org.uk>


Member Enumeration Documentation

enum ShellProcess::Status
 

Current status of the shell process.

  • INACTIVE - start() has not yet been called to run the command.
  • RUNNING - the command is currently running.
  • SUCCESS - the command appears to have exited successfully.
  • UNAUTHORISED - shell commands are not authorised for this user.
  • DIED - the command didn't exit cleanly, i.e. was killed or died.
  • NOT_FOUND - the command was either not found or not executable.
  • START_FAIL - the command couldn't be started for other reasons.

Constructor & Destructor Documentation

ShellProcess::ShellProcess const QString &  command  ) 
 

Constructor.

Parameters:
command The command line to be run when start() is called.

Member Function Documentation

bool ShellProcess::start  ) 
 

Executes the configured command.

Status ShellProcess::status  )  const [inline]
 

Returns the current status of the shell process.

bool ShellProcess::normalExit  )  const [inline]
 

Returns whether the command was run successfully.

Returns:
True if the command has been run and appears to have exited successfully.

const QString& ShellProcess::command  )  const [inline]
 

Returns the command configured to be run.

QString ShellProcess::errorMessage  )  const
 

Returns the error message corresponding to the command exit status.

Returns:
Error message if an error occurred. Null string if the command has not yet exited, or if the command ran successfully.

bool ShellProcess::authorised  )  [static]
 

Returns whether the user is authorised to run shell commands.

Shell commands may be prohibited in kiosk mode, for example.

static const QCString& ShellProcess::shellName  )  [inline, static]
 

Determines which shell to use.

Returns:
file name of shell, excluding path.

const QCString & ShellProcess::shellPath  )  [static]
 

Determines which shell to use.

Returns:
path name of shell.

void ShellProcess::shellExited ShellProcess  )  [signal]
 

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.


The documentation for this class was generated from the following files: