PHP Class System_ProcessIO, atk4

Inheritance: extends AbstractModel
Afficher le fichier Open project: atk4/atk4

Méthodes publiques

Свойство 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

Méthodes publiques

Méthode 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 )

Méthodes protégées

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

Method Details

close() public méthode

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 méthode

public debugStatus ( )

exec() public méthode

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)
Résultat self

executeRaw() protected méthode

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
Résultat array of pipes

execute_raw() protected méthode

protected execute_raw ( $command )

init() public méthode

Initialization of the object.
public init ( )

nice() public méthode

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

readAll() public méthode

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

readLine() public méthode

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)
Résultat self

readStdErr() public méthode

public readStdErr ( )

read_all() public méthode

public read_all ( $res = 'out' )

read_line() public méthode

public read_line ( $res = 'out' )

read_stderr() public méthode

public read_stderr ( )

terminate() public méthode

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

write() public méthode

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.
Résultat self

writeAll() public méthode

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

write_all() public méthode

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