From d999301a9382deb015a3577b28566a4ed450c9c1 Mon Sep 17 00:00:00 2001 From: Robert O'Rourke Date: Wed, 4 Aug 2021 16:43:11 +0000 Subject: [PATCH] Fix docker command switching logic Return code was 0 on linux for missing docker subcommand, this checks the actual output instead. --- inc/composer/class-command.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/composer/class-command.php b/inc/composer/class-command.php index 4a68c30e..07531b5e 100644 --- a/inc/composer/class-command.php +++ b/inc/composer/class-command.php @@ -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,