Skip to content

Commit cfdaabd

Browse files
committed
fix: Generate SSH command broken in WP-CLI 2.12
Adding `cd` break `rsync` rsh argument See: https://github.com/wp-cli/wp-cli/blob/3ca317ad8b50ebaf9580373a383490a82b768f4a/php/WP_CLI/Runner.php#L654-L657
1 parent fa2bf0c commit cfdaabd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Model/Alias.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,15 @@ public function generate_ssh_command( string $command = '' ): string {
300300

301301
$placeholder = '' === $command ? $this->get_random_hash() : '';
302302

303+
// Get SSH bits without path
304+
// Because https://github.com/wp-cli/wp-cli/blob/3ca317ad8b50ebaf9580373a383490a82b768f4a/php/WP_CLI/Runner.php#L654-L657
305+
// introduced in 2.12 https://github.com/wp-cli/wp-cli/commit/82772d90cfe12af1002df1312239cd61ebbb7dab
306+
// breaks rsh
307+
$ssh_bits = $this->get_ssh_bits();
308+
unset( $ssh_bits['path'] );
309+
303310
/** @var string $ssh_command */
304-
$ssh_command = $generate_ssh->invoke( $runner, $this->get_ssh_bits(), '' !== $placeholder ? $placeholder : $command );
311+
$ssh_command = $generate_ssh->invoke( $runner, $ssh_bits, '' !== $placeholder ? $placeholder : $command );
305312

306313
if ( $placeholder ) {
307314
$ssh_command = trim( str_replace( escapeshellarg( $placeholder ), '', $ssh_command ) );

0 commit comments

Comments
 (0)