TYPO3  7.6
Public Member Functions | List of all members
ProcessHelper Class Reference
Inheritance diagram for ProcessHelper:
Helper HelperInterface

Public Member Functions

 run (OutputInterface $output, $cmd, $error=null, $callback=null, $verbosity=OutputInterface::VERBOSITY_VERY_VERBOSE)
 
 mustRun (OutputInterface $output, $cmd, $error=null, $callback=null)
 
 wrapCallback (OutputInterface $output, Process $process, $callback=null)
 
 escapeString ($str)
 
 getName ()
 
- Public Member Functions inherited from Helper
 setHelperSet (HelperSet $helperSet=null)
 
 getHelperSet ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Helper
static strlen ($string)
 
static formatTime ($secs)
 
static formatMemory ($memory)
 
static strlenWithoutDecoration (OutputFormatterInterface $formatter, $string)
 
- Protected Attributes inherited from Helper
 $helperSet = null
 

Detailed Description

The ProcessHelper class provides helpers to run external processes.

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Definition at line 24 of file ProcessHelper.php.

Member Function Documentation

escapeString (   $str)

This method is public for PHP 5.3 compatibility, it should be private.

Definition at line 130 of file ProcessHelper.php.

Referenced by ProcessHelper\run().

getName ( )

{Returns the canonical name of this helper.

Returns
string The canonical name
}

Implements HelperInterface.

Definition at line 138 of file ProcessHelper.php.

mustRun ( OutputInterface  $output,
  $cmd,
  $error = null,
  $callback = null 
)

Runs the process.

This is identical to run() except that an exception is thrown if the process exits with a non-zero exit code.

Parameters
OutputInterface$outputAn OutputInterface instance
string | Process$cmdAn instance of Process or a command to run
string | null$errorAn error message that must be displayed if something went wrong
callable | null$callbackA PHP callback to run whenever there is some output available on STDOUT or STDERR
Returns
Process The process that ran
Exceptions
ProcessFailedException
See Also
run()

Definition at line 90 of file ProcessHelper.php.

References ProcessHelper\run().

run ( OutputInterface  $output,
  $cmd,
  $error = null,
  $callback = null,
  $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE 
)

Runs an external process.

Parameters
OutputInterface$outputAn OutputInterface instance
string | array | Process$cmdAn instance of Process or an array of arguments to escape and run or a command to run
string | null$errorAn error message that must be displayed if something went wrong
callable | null$callbackA PHP callback to run whenever there is some output available on STDOUT or STDERR
int$verbosityThe threshold for verbosity
Returns
Process The process that ran

Definition at line 38 of file ProcessHelper.php.

References elseif, ProcessHelper\escapeString(), Helper\getHelperSet(), ProcessHelper\wrapCallback(), OutputInterface\write(), and OutputInterface\writeln().

Referenced by ProcessHelper\mustRun().

wrapCallback ( OutputInterface  $output,
Process  $process,
  $callback = null 
)

Wraps a Process callback to add debugging output.

Parameters
OutputInterface$outputAn OutputInterface interface
Process$processThe Process
callable | null$callbackA PHP callable
Returns
callable

Definition at line 110 of file ProcessHelper.php.

References Helper\getHelperSet(), and OutputInterface\write().

Referenced by ProcessHelper\run().