Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set TTY depending on execution context for all processes #332

Merged
merged 3 commits into from
Aug 16, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions inc/composer/class-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,13 @@ protected function destroy( InputInterface $input, OutputInterface $output ) {
$output->writeln( '<error>Destroying...</>' );

$compose = new Process( $this->get_compose_command( 'down -v --remove-orphans', true ), 'vendor', $this->get_env() );
$compose->setTty( true );
$return_val = $compose->run( function ( $type, $buffer ) {
echo $buffer;
} );

$proxy = new Process( $this->get_compose_command( '-f proxy.yml down -v' ), 'vendor/altis/local-server/docker' );
$proxy->setTty( true );
$proxy->run( function ( $type, $buffer ) {
echo $buffer;
} );
Expand All @@ -347,6 +349,7 @@ protected function restart( InputInterface $input, OutputInterface $output ) {
$output->writeln( '<info>Restarting...</>' );

$proxy = new Process( $this->get_compose_command( '-f proxy.yml restart' ), 'vendor/altis/local-server/docker' );
$proxy->setTty( true );
$proxy->run( function ( $type, $buffer ) {
echo $buffer;
} );
Expand All @@ -358,6 +361,7 @@ protected function restart( InputInterface $input, OutputInterface $output ) {
$service = '';
}
$compose = new Process( $this->get_compose_command( "restart $service", true ), 'vendor', $this->get_env() );
$compose->setTty( true );
$return_val = $compose->run( function ( $type, $buffer ) {
echo $buffer;
} );
Expand Down Expand Up @@ -450,6 +454,7 @@ protected function exec( InputInterface $input, OutputInterface $output, ?string
*/
protected function status( InputInterface $input, OutputInterface $output ) {
$compose = new Process( $this->get_compose_command( 'ps' ), 'vendor', $this->get_env() );
$compose->setTty( true );
return $compose->run( function ( $type, $buffer ) {
echo $buffer;
} );
Expand All @@ -465,6 +470,7 @@ protected function status( InputInterface $input, OutputInterface $output ) {
protected function logs( InputInterface $input, OutputInterface $output ) {
$log = $input->getArgument( 'options' )[0];
$compose = new Process( $this->get_compose_command( 'logs --tail=100 -f ' . $log ), 'vendor', $this->get_env() );
$compose->setTty( true );
$compose->setTimeout( 0 );
return $compose->run( function ( $type, $buffer ) {
echo $buffer;
Expand Down