Skip to content

Commit

Permalink
Fix docker command switching logic
Browse files Browse the repository at this point in the history
Return code was 0 on linux for missing docker subcommand, this checks the actual output instead.
  • Loading branch information
roborourke committed Aug 4, 2021
1 parent d8c6a58 commit d999301
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions inc/composer/class-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,8 @@ protected function is_mutagen_installed() : bool {
protected function get_compose_command( string $command = '', bool $mutagen = false ) : string {
static $default_command;
if ( empty( $default_command ) ) {
exec( 'docker compose', $output, $ret );
$default_command = $ret === 0 ? 'docker compose' : 'docker-compose';
exec( 'docker compose', $output );
$default_command = strpos( implode( "\n", $output ), 'Usage: docker compose' ) !== false ? 'docker compose' : 'docker-compose';
}
return sprintf( '%s %s',
$this->is_mutagen_installed() && $mutagen ? 'mutagen compose' : $default_command,
Expand Down

0 comments on commit d999301

Please sign in to comment.