Methods |
public
|
__construct()
|
#
|
public
|
setDescriptor(int $fd, string $type, string|array $mode, string $alias = '', array $opts = []): $this|bool
Parameters
$fd |
descriptor number
|
$type |
pipe or file
|
$mode |
pipe mode or [file, file mode]
|
$alias |
nickname
|
|
#
|
public
|
getOption($name)
|
#
|
public
|
getPipeNames(): array
Get all defined pipe names, alias preferred
Get all defined pipe names, alias preferred
|
#
|
public
|
setDescriptorOption($fd, $opt, $value)
|
#
|
public
static
|
exec(array|string $cmd, mixed $args = null, array $exits = [0], array $opts = []): array
Execute a program Optional parameters:
run (bool) : execute process automatically
fd (array): file descriptors consisting of an array of descriptor-specific options fd options:
close (bool): close pipe on creation - useful with stdin
Execute a program Optional parameters:
run (bool) : execute process automatically
fd (array): file descriptors consisting of an array of descriptor-specific options fd options:
close (bool): close pipe on creation - useful with stdin
Parameters
$cmd |
command
|
$args |
format arguments
|
$exits |
permitted exit values
|
$opts |
optional process options
|
|
#
|
public
static
|
decompose($cmd): array
Break a full command down into its command + arguments in bash/sh dialect
Break a full command down into its command + arguments in bash/sh dialect
|
#
|
public
static
|
mkfifo(string $path = '/tmp'): string|null
|
#
|
public
|
__destruct()
|
#
|
public
|
run($cmd, ...$args)
|
#
|
public
|
setPriority(int $prio): $this|bool|void
|
#
|
public
|
setSuid($user): void
|
#
|
public
|
setSgid($group): void
|
#
|
public
|
process(): unknown_type
|
#
|
public
|
getDescriptors()
|
#
|
public
|
getDescriptorMode(int|string $fd): string
Get mode assigned to descriptor
Get mode assigned to descriptor
Parameters
Returns
|
#
|
public
|
getDescriptorType(int|string $fd): string
Get type assigned to descriptor
Get type assigned to descriptor
Parameters
Returns
|
#
|
public
|
getDescriptorOptions($fd)
|
#
|
public
|
pipeClose(int|resource &$pipe): bool
|
#
|
public
&
|
getPipePeer()
|
#
|
public
|
getProcessStatus(): array|null
|
#
|
public
|
pipe($cmd, ...$args)
|
#
|
public
|
pipeProcess(Util_Process &$peer): object
Attach another program's output to program input
Attach another program's output to program input
Parameters
$peer |
processs created by create()
|
|
#
|
public
|
setEncoding($mode, $fd = null)
|
#
|
public
|
pipeDescriptor($read, $write)
|
#
|
public
|
forceRun(): bool|Util_Process
Force a delayed start Used in conjunction with setOption("run", false)
Force a delayed start Used in conjunction with setOption("run", false)
|
#
|
public
|
running()
|
#
|
public
|
format(string $fmt = 'apnscp'): mixed
Transform process data
Format options:
esprit: traditional apnscp esprit format
stderr, stdout, output, error, return, errno fields
Transform process data
Format options:
esprit: traditional apnscp esprit format
stderr, stdout, output, error, return, errno fields
Parameters
|
#
|
public
|
getExit(): int
|
#
|
public
|
exitSuccess()
|
#
|
public
|
getOutput($pipe)
|
#
|
public
|
addEnvironment($name, $val): $this
Add environment exported to child process via putenv()
Add environment exported to child process via putenv()
Returns
|
#
|
public
|
setResource(array $limits): void
Set resource limits for process
Set resource limits for process
Parameters
$limits |
key => value limits
|
|
#
|
public
|
setEnvironment(mixed $name, mixed $val = null): $this
Set environment variable overwriting if set
Set environment variable overwriting if set
Returns
|
#
|
public
|
unsetEnvironment($var)
|
#
|
public
|
getEnvironment()
|
#
|
public
|
close(): int
|
#
|
public
|
pipeRead(int|resource $pipe, int $length = -1, int $offset = 0): string
|
#
|
public
|
pipeWrite(int|resource $pipe, string $data, int $length = null): int
|
#
|
public
|
getExits()
|
#
|
public
|
setExits($exits = '/./')
|
#
|
public
|
getCommand(bool $raw = false): string
|
#
|
public
|
setOption(string $name, mixed $val = null): $this
Set process option Create callback methods using camel case
_ is stripped, e.g. tv_usec -> setTvUsec
Set process option Create callback methods using camel case
_ is stripped, e.g. tv_usec -> setTvUsec
Parameters
|
#
|
public
|
setUnshare(Unshare $pool)
Add unshare resource to execution context
Add unshare resource to execution context
|
#
|
public
|
setTee($file)
|
#
|
public
|
addCallback(callable $function, string $when = 'read', array ...$args): void
Parameters
$when |
callback context $this->callbacks
|
...$args |
additional arguments to pass
|
|
#
|
public
|
getDescriptorOption($fd, $opt)
|
#
|
public
|
deleteCallback(string $when, string $namespace = ''): bool|void
Delete a registered callback
Delete a registered callback
Parameters
$when |
callback context (read, write, close)
|
$namespace |
optional namespace
|
|
#
|