PHP Class System_ProcessIO, atk4

Inheritance: extends AbstractModel
Datei anzeigen Open project: atk4/atk4

Public Properties

Property Type Description
$args
$cmd
$descriptorspec allow us to execute commands in a flexible and easy way
$exic_code
$pipes
$process contain descriptions for stdin/out/err
$stderr

Public Methods

Method Description
close ( $res = null ) This function will finish reading from in/err streams and will close all streams. If you are doing your own reading line-by-line or you want to terminate application without reading all of it's output - use terminate() instead;.
debugStatus ( )
exec ( string $cmd, array | string $args = [] ) : self Execute the process and associate with this object.
init ( ) Initialization of the object.
nice ( integer $nice ) Set "nice" value for the process.
readAll ( string $res = 'out' ) : self Reads all output and returns. Closes stdout when EOF reached.
readLine ( string $res = 'out' ) : self Reads one line of output. Careful - if no output is provided it this function will be waiting.
readStdErr ( )
read_all ( $res = 'out' )
read_line ( $res = 'out' )
read_stderr ( )
terminate ( integer $sig = null ) Closing IO and terminating.
write ( string $str ) : self Sends string to process, but process will wait for more input. Always adds newline at the end.
writeAll ( string $str ) : self Similar to write but will send EOF after sending text.
write_all ( $str )

Protected Methods

Method Description
executeRaw ( string $command ) : array This function just executes command and returns hash of descriptors.
execute_raw ( $command )

Method Details

close() public method

This function will finish reading from in/err streams and will close all streams. If you are doing your own reading line-by-line or you want to terminate application without reading all of it's output - use terminate() instead;.
public close ( $res = null )

debugStatus() public method

public debugStatus ( )

exec() public method

Execute the process and associate with this object.
public exec ( string $cmd, array | string $args = [] ) : self
$cmd string Command to be executed
$args array | string Arguments (strings)
return self

executeRaw() protected method

Hash will have keys 'in', 'out' and 'err'. This is a handy function to override if you are piping input and output through sockets (such as SSH connection)
protected executeRaw ( string $command ) : array
$command string raw and proprely escaped command
return array of pipes

execute_raw() protected method

protected execute_raw ( $command )

init() public method

Initialization of the object.
public init ( )

nice() public method

Set "nice" value for the process.
public nice ( integer $nice )
$nice integer Nice level 0 .. 20

readAll() public method

Reads all output and returns. Closes stdout when EOF reached.
public readAll ( string $res = 'out' ) : self
$res string optional descriptor (out or err)
return self

readLine() public method

Reads one line of output. Careful - if no output is provided it this function will be waiting.
public readLine ( string $res = 'out' ) : self
$res string optional descriptor (either out or err)
return self

readStdErr() public method

public readStdErr ( )

read_all() public method

public read_all ( $res = 'out' )

read_line() public method

public read_line ( $res = 'out' )

read_stderr() public method

public read_stderr ( )

terminate() public method

Closing IO and terminating.
public terminate ( integer $sig = null )
$sig integer Unix signal

write() public method

Sends string to process, but process will wait for more input. Always adds newline at the end.
public write ( string $str ) : self
$str string any input data.
return self

writeAll() public method

Also makes sure your list do not end with endline (because write adds it).
public writeAll ( string $str ) : self
$str string any input data.
return self

write_all() public method

public write_all ( $str )

Property Details

$args public_oe property

public $args

$cmd public_oe property

public $cmd

$descriptorspec public_oe property

allow us to execute commands in a flexible and easy way
public $descriptorspec

$exic_code public_oe property

public $exic_code

$pipes public_oe property

public $pipes

$process public_oe property

contain descriptions for stdin/out/err
public $process

$stderr public_oe property

public $stderr