Phastlight\Module\ChildProcess\Main::exec PHP Method

exec() public method

public exec ( $command, $callback )
    public function exec($command, $callback)
    {
        $process = new Process($command);
        $process->run(function ($type, $buffer) use($callback) {
            $error = null;
            $stdout = null;
            $stderr = null;
            if ('err' === $type) {
                $stderr = $buffer;
                $error = true;
                //@TODO: need to fine tuned more on the error code...
            } else {
                $stdout = $buffer;
            }
            $callback($error, $stdout, $stderr);
        });
    }