Mar 16, 2018
0
Level 2
How to run multiple commands with Symfony\Component\Process\Process
Hi
We use a https://www.cloudfoundry.org/ hosting for our app.
To connect to the server we have to use cf ssh APP-NAME instead of the normal ssh command.
Now i want to write a simple Task runner like https://deployer.org/ to run some artisan commands on the server.
For that i tired Symfony\Component\Process\Process, wich works for connecting to the server but i can't keep the connection open to run some other commands.
Does anyone know how to keep the connection open and run some commands?
Here is my current code:
use Symfony\Component\Process\Process;
$process = new Process("cf ssh APP-NAME");
$process->setPTY(true);
// Add some other commands like "php artisan migrate"
$process->run();
echo $process->getOutput();
Please or to participate in this conversation.