Created
February 2, 2019 14:06
-
-
Save Shaked/7cc7541d1743c641c947c006c15903e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
.. | |
.. | |
$cmd = 'docker build someimage'; | |
$process = Process::fromShellCommandline($cmd); | |
$process->setTimeout(0); | |
$process->run(function ($type, $buffer) { | |
if (Process::ERR === $type) { | |
echo 'ERR > '.$buffer; | |
} else { | |
echo 'OUT > '.$buffer; | |
} | |
}); | |
// executes after the command finishes | |
if (!$process->isSuccessful()) { | |
throw new ProcessFailedException($process); | |
} | |
return $process->getOutput(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment