Пример #1
0
 public function testShouldStoreReturnValue()
 {
     $GLOBALS['arara']['exec']['return_var'] = 0;
     $control = new Control();
     $context = new Context();
     $action = new Command('echo', array('Arara\\nProcess'));
     $action->execute($control, $context);
     $actualReturn = $context->returnValue;
     $expectedReturn = 0;
     $this->assertEquals($expectedReturn, $actualReturn);
 }
Пример #2
0
<?php

declare (ticks=1);
require_once __DIR__ . '/../vendor/autoload.php';
use Arara\Process\Action\Command;
use Arara\Process\Child;
use Arara\Process\Context;
use Arara\Process\Control;
$command = new Command('find', array(__DIR__, '-name' => '*', '-type' => 'f'));
$command->bind(Command::EVENT_FINISH, function (Context $context) {
    echo json_encode($context->toArray(), JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT) . PHP_EOL;
});
$control = new Control();
$child = new Child($command, $control);
$child->start();
$child->wait();