ClearFoundation

ClearOS API

Class ShellExec

Description

Wrapper for running shell commands.

Located in /api/ShellExec.class.php (line 53)

Engine
   |
   --ShellExec
Class Constant Summary
 CMD_SUEXEC = "/usr/bin/sudo"
Variable Summary
mixed $output
Method Summary
ShellExec __construct ()
void __destruct ()
int Execute (string $command, string $arguments, [boolean $superuser = false], [array $options = null])
string GetFirstOutputLine ()
string GetLastOutputLine ()
array GetOutput ()
Variables
mixed $output = array() (line 59)
  • access: protected

Inherited Variables

Inherited from Engine

Engine::$errors
Methods
Constructor __construct (line 71)

ShellExec constructor.

  • access: public
ShellExec __construct ()

Redefinition of:
Engine::__construct()
Engine constructor.
Destructor __destruct (line 217)
  • access: public
void __destruct ()

Redefinition of:
Engine::__destruct()
Execute (line 99)

Executes the command.

Excecute options are:

  • escape: scrub command line arguments for naught characters (default true)
  • log: specify a log file (default /dev/null)
  • env: environment variables (default null)
  • background: run command in background (default false)
  • stdin: write arguments to stdin (default false)
  • return: command return code
  • throws: ValidationException, EngineException
  • access: public
int Execute (string $command, string $arguments, [boolean $superuser = false], [array $options = null])
  • string $command: command to excecute
  • string $arguments: command arguments
  • boolean $superuser: super user flag
  • array $options: extra execute options specified above
GetFirstOutputLine (line 189)

Returns first output line.

This method is useful for capturing simple command output (including errors).

  • return: first output line
  • access: public
string GetFirstOutputLine ()
GetLastOutputLine (line 205)

Returns last output line.

This method is useful for capturing the last line of output (including errors).

  • return: last output line
  • access: public
string GetLastOutputLine ()
GetOutput (line 176)

Returns output from executed command.

  • return: command output as an array of strings
  • access: public
array GetOutput ()

Inherited Methods

Inherited From Engine

Engine::__construct()
Engine::AddValidationError()
Engine::CheckValidationErrors()
Engine::CopyValidationErrors()
Engine::GetValidationErrors()
Engine::Log()
Engine::__destruct()
Class Constants
CMD_SUEXEC = "/usr/bin/sudo" (line 61)

Inherited Constants

Inherited from Engine

Engine::COMMAND_API

Documentation generated on Fri, 28 Aug 2009 20:32:18 -0400 by phpDocumentor 1.3.2