Created
November 2, 2017 23:07
-
-
Save bayareawebpro/f48103040ae42aa19b24f54307ce0114 to your computer and use it in GitHub Desktop.
Call Envoy from Route
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 | |
$result = []; | |
$task = 'deploy'; | |
$live = true; | |
$process = new \Symfony\Component\Process\Process('/Applications/MAMP/bin/php/php7.1.0/bin/php ~/.composer/vendor/bin/envoy run '. $task); | |
$process->setTimeout(3600); | |
$process->setIdleTimeout(300); | |
$process->setWorkingDirectory(base_path()); | |
$process->run( | |
function ($type, $buffer) use ($live, &$result) { | |
$buffer = str_replace('[-i ~/.ssh/host_key user@host.com]: ', '', $buffer); | |
if ($live) { | |
echo $buffer . '</br />'; | |
} | |
$result[] = $buffer; | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment