\App\CoreModule\ModelsCommandManager

Tool for executing commands

Summary

Methods
Properties
Constants
__construct()
commandExist()
run()
runAsync()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
createProcess()
$sudo
$stack
N/A

Properties

$sudo

$sudo : bool

Type

normal — Is sudo required?

$stack

$stack : \App\CoreModule\Entities\CommandStack

Type

normal — Command stack

Methods

__construct()

__construct(bool  $sudo, \App\CoreModule\Entities\CommandStack  $stack) : mixed

Constructor

Parameters

bool $sudo

Is sudo required?

\App\CoreModule\Entities\CommandStack $stack

Command stack

Returns

mixed

commandExist()

commandExist(string  $cmd) : bool

Checks the existence of a command

Parameters

string $cmd

Command

Returns

bool —

Is the command exists?

run()

run(string  $command, bool  $needSudo = false) : \App\CoreModule\Entities\ICommand

Executes shell command and returns output

Parameters

string $command

Command to execute

bool $needSudo

Does the command need sudo?

Returns

\App\CoreModule\Entities\ICommand —

Command entity

runAsync()

runAsync(callable  $callback, string  $command, bool  $needSudo = false, int  $timeout = 36000) : void

Executes the command asynchronously

Parameters

callable $callback

Callback to run whenever there is some output available on STDOUT or STDERR

string $command

Command to execute

bool $needSudo

Does the command need sudo?

int $timeout

Command's timeout

createProcess()

createProcess(string  $cmd, bool  $needSudo) : \Symfony\Component\Process\Process

Creates the process

Parameters

string $cmd

Command to execute

bool $needSudo

Does the command need sudo?

Returns

\Symfony\Component\Process\Process —

Created process