From 9c1aaa53374aedf3630475c5bd33fc6a11ce86ef Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Tue, 14 Jun 2016 09:51:12 -0700 Subject: [PATCH] Provide more verbosity when `--ssh` fails ``` $ wp --ssh=foo option get home Error: Cannot connect over SSH using provided configuration. ``` Unfortunately, it doesn't seem possible to capture the SSH error itself. `-o LogLevel=ERROR` still includes the "Connection closed" message. --- php/WP_CLI/Runner.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/php/WP_CLI/Runner.php b/php/WP_CLI/Runner.php index de6f29c024..485c3eaf9a 100644 --- a/php/WP_CLI/Runner.php +++ b/php/WP_CLI/Runner.php @@ -368,7 +368,9 @@ private function run_ssh_command( $ssh ) { ); passthru( $escaped_command, $exit_code ); - if ( 0 !== $exit_code ) { + if ( 255 === $exit_code ) { + WP_CLI::error( 'Cannot connect over SSH using provided configuration.', 255 ); + } else { exit( $exit_code ); } }