Created
April 19, 2017 19:37
-
-
Save mariusbalcytis/65b5799db0c04f0f82eb97c2be77db40 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 | |
<<<CONFIG | |
packages: | |
- "symfony/process: 3.2" | |
CONFIG; | |
use Symfony\Component\Process\Process; | |
use Symfony\Component\Process\ProcessBuilder; | |
$executable = 'echo'; | |
$arguments = ['test1', 'test2']; | |
$processBuilder = new ProcessBuilder(); | |
$processBuilder->setArguments(array_merge( | |
[$executable], | |
$arguments | |
)); | |
$process = $processBuilder->getProcess(); | |
if (DIRECTORY_SEPARATOR !== '\\') { | |
$process->setCommandLine('exec ' . $process->getCommandLine()); | |
} | |
$process->mustRun(function ($type, $buffer) { | |
echo $buffer; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment