Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions features/aliases.feature
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Feature: Create shortcuts to specific WordPress installs
When I try `wp @foo --debug --version`
Then STDERR should contain:
"""
Running SSH command: ssh -q -J 'proxyhost'
Running SSH command: ssh -J 'proxyhost' -T -vvv
"""

Scenario: Adds key to ssh command
Expand All @@ -201,7 +201,7 @@ Feature: Create shortcuts to specific WordPress installs
When I try `wp @foo --debug --version`
Then STDERR should contain:
"""
Running SSH command: ssh -q -i 'identityfile.key'
Running SSH command: ssh -i 'identityfile.key' -T -vvv
"""

Scenario: Add an alias
Expand Down
4 changes: 2 additions & 2 deletions features/flags.feature
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,14 @@ Feature: Global flags
When I try `WP_CLI_STRICT_ARGS_MODE=1 wp --debug --ssh=/ --version`
Then STDERR should contain:
"""
Running SSH command: ssh -q -T '' 'WP_CLI_STRICT_ARGS_MODE=1 wp
Running SSH command: ssh -T -vvv '' 'WP_CLI_STRICT_ARGS_MODE=1 wp
"""

Scenario: SSH flag should support changing directories
When I try `wp --debug --ssh=wordpress:/my/path --version`
Then STDERR should contain:
"""
Running SSH command: ssh -q -T 'wordpress' 'cd '\''/my/path'\''; wp
Running SSH command: ssh -T -vvv 'wordpress' 'cd '\''/my/path'\''; wp
"""

Scenario: SSH flag should support Docker
Expand Down
7 changes: 4 additions & 3 deletions php/WP_CLI/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ private function generate_ssh_command( $bits, $wp_command ) {

// Default scheme is SSH.
if ( 'ssh' === $bits['scheme'] || null === $bits['scheme'] ) {
$command = 'ssh -q %s %s %s';
$command = 'ssh %s %s %s';

if ( $bits['user'] ) {
$bits['host'] = $bits['user'] . '@' . $bits['host'];
Expand All @@ -655,10 +655,11 @@ private function generate_ssh_command( $bits, $wp_command ) {
}

$command_args = [
$bits['proxyjump'] ? sprintf( '-J %s ', escapeshellarg( $bits['proxyjump'] ) ) : '',
$bits['port'] ? '-p ' . (int) $bits['port'] . ' ' : '',
$bits['proxyjump'] ? sprintf( '-J %s', escapeshellarg( $bits['proxyjump'] ) ) : '',
$bits['port'] ? sprintf( '-p %d', (int) $bits['port'] ) : '',
$bits['key'] ? sprintf( '-i %s', escapeshellarg( $bits['key'] ) ) : '',
$is_tty ? '-t' : '-T',
WP_CLI::get_config( 'debug' ) ? '-vvv' : '-q',
];

$escaped_command = sprintf(
Expand Down