Skip to content

Commit 0882b70

Browse files
author
Raphaël Droz
committed
If we don't intend to connect through docker, don't even exec() it in the first place. Less syscalls and more apparmor-friendly behavior
1 parent c0513d0 commit 0882b70

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

php/WP_CLI/Runner.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,10 +580,12 @@ private function generate_ssh_command( $bits, $wp_command ) {
580580
$is_stdout_tty = function_exists( 'posix_isatty' ) && posix_isatty( STDOUT );
581581
$is_stdin_tty = function_exists( 'posix_isatty' ) ? posix_isatty( STDIN ) : true;
582582

583-
$docker_compose_v2_version_cmd = Utils\esc_cmd( Utils\force_env_on_nix_systems( 'docker' ) . ' compose %s', 'version' );
584-
$docker_compose_cmd = ! empty( Process::create( $docker_compose_v2_version_cmd )->run()->stdout )
585-
? 'docker compose'
586-
: 'docker-compose';
583+
if ( in_array( $bits['scheme'], [ 'docker', 'docker-compose', 'docker-compose-run' ], true ) ) {
584+
$docker_compose_v2_version_cmd = Utils\esc_cmd( Utils\force_env_on_nix_systems( 'docker' ) . ' compose %s', 'version' );
585+
$docker_compose_cmd = ! empty( Process::create( $docker_compose_v2_version_cmd )->run()->stdout )
586+
? 'docker compose'
587+
: 'docker-compose';
588+
}
587589

588590
if ( 'docker' === $bits['scheme'] ) {
589591
$command = 'docker exec %s%s%s%s%s sh -c %s';

0 commit comments

Comments
 (0)