PHP Class PHPDaemon\Core\ShellCommand

Author: Vasily Zorin ([email protected])
Inheritance: extends PHPDaemon\Network\IOStream
显示文件 Open project: kakserpom/phpdaemon Class Usage Examples

Public Properties

Property Type Description
$binPath Executable path
$chroot Chroot
$cwd Chdir
$setGroup SGID
$setUser SUID

Protected Properties

Property Type Description
$EOF Got EOF?
$args Array of arguments
$bevErr EventBufferEvent
$bevWrite EventBufferEvent
$cmd Command string
$env Hash of environment's variables
$errlogfile Path to error logfile
$fdWrite FD write
$finishWrite
$nice Process priority
$outputErrors Output errors?
$pd Process descriptor
$pipes Opened pipes

Public Methods

Method Description
buildArgs ( array $args ) : string Build arguments string from associative/enumerated array (may be mixed)
close ( ) : void Close the process
closeWrite ( ) : this Close write stream
eof ( ) : boolean Got EOF?
exec ( string $binPath = null, callable $cb = null, array $args = null, array $env = null ) Execute
execute ( string $binPath = null, array $args = null, array $env = null ) : this Execute
finishWrite ( ) : boolean Finish write stream
getCmd ( ) : string Get command string
getStatus ( )
nice ( integer $nice = null ) : this Set priority
onEOF ( callable $cb = null ) : this Sets callback which will be called once when got EOF
onEofEvent ( ) : void Called when got EOF
onFinish ( ) Called when stream is finished
setArgs ( $args = null ) : this Sets an array of arguments
setChroot ( string $dir ) : this Set chroot
setCwd ( string $dir ) : this Set cwd
setEnv ( $env = null ) : this Set a hash of environment's variables
setFd ( resource $fd, EventBufferEvent $bev = null ) : void Sets fd
setGroup ( $val ) : this Set group
setUser ( string $val ) : this Set group
write ( string $data ) : boolean Send data to the connection. Note that it just writes to buffer that flushes at every baseloop
writeln ( $data ) : boolean Send data and appending \n to connection. Note that it just writes to buffer flushed at every baseloop

Protected Methods

Method Description
onRead ( ) : this | null Called when new data received

Method Details

buildArgs() public static method

Build arguments string from associative/enumerated array (may be mixed)
public static buildArgs ( array $args ) : string
$args array
return string

close() public method

Close the process
public close ( ) : void
return void

closeWrite() public method

Close write stream
public closeWrite ( ) : this
return this

eof() public method

Got EOF?
public eof ( ) : boolean
return boolean

exec() public static method

Execute
public static exec ( string $binPath = null, callable $cb = null, array $args = null, array $env = null )
$binPath string Binpath
$cb callable Callback
$args array Optional. Arguments
$env array Optional. Hash of environment's variables

execute() public method

Execute
public execute ( string $binPath = null, array $args = null, array $env = null ) : this
$binPath string Optional. Binpath
$args array Optional. Arguments
$env array Optional. Hash of environment's variables
return this

finishWrite() public method

Finish write stream
public finishWrite ( ) : boolean
return boolean

getCmd() public method

Get command string
public getCmd ( ) : string
return string

getStatus() public method

public getStatus ( )

nice() public method

Set priority
public nice ( integer $nice = null ) : this
$nice integer Priority
return this

onEOF() public method

Sets callback which will be called once when got EOF
public onEOF ( callable $cb = null ) : this
$cb callable
return this

onEofEvent() public method

Called when got EOF
public onEofEvent ( ) : void
return void

onFinish() public method

Called when stream is finished
public onFinish ( )

onRead() protected method

Called when new data received
protected onRead ( ) : this | null
return this | null

setArgs() public method

Sets an array of arguments
public setArgs ( $args = null ) : this
return this

setChroot() public method

Set chroot
public setChroot ( string $dir ) : this
$dir string
return this

setCwd() public method

Set cwd
public setCwd ( string $dir ) : this
$dir string
return this

setEnv() public method

Set a hash of environment's variables
public setEnv ( $env = null ) : this
return this

setFd() public method

Sets fd
public setFd ( resource $fd, EventBufferEvent $bev = null ) : void
$fd resource File descriptor
$bev EventBufferEvent
return void

setGroup() public method

Set group
public setGroup ( $val ) : this
return this

setUser() public method

Set group
public setUser ( string $val ) : this
$val string
return this

write() public method

Send data to the connection. Note that it just writes to buffer that flushes at every baseloop
public write ( string $data ) : boolean
$data string Data to send
return boolean Success

writeln() public method

Send data and appending \n to connection. Note that it just writes to buffer flushed at every baseloop
public writeln ( $data ) : boolean
return boolean Success

Property Details

$EOF protected_oe property

Got EOF?
protected $EOF

$args protected_oe property

Array of arguments
protected $args

$bevErr protected_oe property

protected EventBufferEvent $bevErr
return EventBufferEvent

$bevWrite protected_oe property

protected EventBufferEvent $bevWrite
return EventBufferEvent

$binPath public_oe property

Executable path
public $binPath

$chroot public_oe property

Chroot
public $chroot

$cmd protected_oe property

Command string
protected $cmd

$cwd public_oe property

Chdir
public $cwd

$env protected_oe property

Hash of environment's variables
protected $env

$errlogfile protected_oe property

Path to error logfile
protected $errlogfile

$fdWrite protected_oe property

FD write
protected $fdWrite

$finishWrite protected_oe property

protected $finishWrite

$nice protected_oe property

Process priority
protected $nice

$outputErrors protected_oe property

Output errors?
protected $outputErrors

$pd protected_oe property

Process descriptor
protected $pd

$pipes protected_oe property

Opened pipes
protected $pipes

$setGroup public_oe property

SGID
public $setGroup

$setUser public_oe property

SUID
public $setUser