ExecTrait
trait ExecTrait (View source)
Class ExecTrait
Properties
protected bool | $background | ||
protected null|int | $timeout | ||
protected null|int | $idleTimeout | ||
protected null|array | $env | ||
protected Process | $process | ||
protected resource|string | $input | ||
protected bool | $interactive | ||
protected bool | $isPrinted | ||
protected bool | $isMetadataPrinted | ||
protected string | $workingDirectory |
Methods
No description
No description
No description
No description
No description
No description
No description
No description
No description
Sets $this->interactive() based on posix_isatty().
Executes command in background mode (asynchronously)
Stop command if it runs longer then $timeout in seconds
Stops command if it does not output something for a while
Set a single environment variable, or multiple.
Sets the environment variables for the command
Pass an input to the process. Can be resource created with fopen() or string
Pass an input to the process. Can be resource created with fopen() or string
Attach tty to process for interactive input
Is command printing its output to screen
Changes working directory of command
Shortcut for setting isPrinted() and isMetadataPrinted() to false.
Should command output be printed
Should command metadata be printed. I,e., command and timer.
No description
No description
No description
No description
Gets the data array to be passed to Result().
Details
abstract string
getCommandDescription()
No description
abstract protected
startTimer()
No description
abstract protected
stopTimer()
No description
abstract protected null|float
getExecutionTime()
No description
abstract protected bool
hideTaskProgress()
No description
abstract protected
showTaskProgress(bool $inProgress)
No description
abstract protected
printTaskInfo(string $text, null|array $context = null)
No description
abstract bool
verbosityMeetsThreshold()
No description
abstract
writeMessage(string $message)
No description
$this
detectInteractive()
Sets $this->interactive() based on posix_isatty().
$this
background(bool $arg = true)
Executes command in background mode (asynchronously)
$this
timeout(int $timeout)
Stop command if it runs longer then $timeout in seconds
$this
idleTimeout(int $timeout)
Stops command if it does not output something for a while
$this
env(string|array $env, bool|string $value = null)
Set a single environment variable, or multiple.
$this
envVars(array $env)
Sets the environment variables for the command
$this
setProcessInput(resource|string $input)
Pass an input to the process. Can be resource created with fopen() or string
$this
setInput(resource|string $input)
deprecated
deprecated
Pass an input to the process. Can be resource created with fopen() or string
$this
interactive(bool $interactive = true)
Attach tty to process for interactive input
bool
getPrinted()
Is command printing its output to screen
$this
dir(string $dir)
Changes working directory of command
$this
silent(bool $arg)
Shortcut for setting isPrinted() and isMetadataPrinted() to false.
$this
printed(bool $arg)
deprecated
deprecated
Should command output be printed
$this
printOutput(bool $arg)
Should command output be printed
$this
printMetadata(bool $arg)
Should command metadata be printed. I,e., command and timer.
protected ResultData
execute(Process $process, callable $output_callback = null)
No description
protected
stop()
No description
protected
printAction(array $context = [])
No description
protected string
formatCommandDisplay(string $command)
No description
protected array
getResultData()
Gets the data array to be passed to Result().