Skip to content
Merged
Changes from all commits
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
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
  • Loading branch information
drzraf committed Mar 4, 2025
commit 0882b704cb803b7dbfee55ad29888097044e844a
10 changes: 6 additions & 4 deletions php/WP_CLI/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,10 +580,12 @@ private function generate_ssh_command( $bits, $wp_command ) {
$is_stdout_tty = function_exists( 'posix_isatty' ) && posix_isatty( STDOUT );
$is_stdin_tty = function_exists( 'posix_isatty' ) ? posix_isatty( STDIN ) : true;

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

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