Show quoted text>________________________________
> From: "liam.gretton@gmail.com via RT" <bug-Net-OpenSSH@rt.cpan.org>
>To:
>Sent: Wednesday, January 29, 2014 12:40 PM
>Subject: [rt.cpan.org #92556] Net::OpenSSH->new() doesn't trap all errors
>
>
>Wed Jan 29 06:40:11 2014: Request 92556 was acted upon.
>Transaction: Ticket created by liam.gretton@gmail.com
> Queue: Net-OpenSSH
> Subject: Net::OpenSSH->new() doesn't trap all errors
> Broken in: (no value)
> Severity: (no value)
> Owner: Nobody
> Requestors: liam.gretton@gmail.com
> Status: new
>Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=92556 >
>
>
>I'd expect Net::OpenSSH->new() to have all errors trapped and reported
>only via Net::OpenSSH2->error() but they're not.
>
>my $ssh = Net::OpenSSH->($host, user => "wronguser");
>
>if ($ssh->error) {
> print "Error: ".$ssh-error."\n";
> exit(1);
>}
>
>
>On executing this, where 'wronguser' is invalid...
>
>Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
That msg is sent by OpenSSH ssh directly to stderr. If you want to hide it, just redirect ssh stderr to dev null:
$ssh = Net::OpenSSH->new($host, user => 'wronguser',
master_stderr_discard => 1)
Alternatively you may want to redirect it to a temporary file so you can show it to the user in some way, later, upon failure.
Show quoted text>Error: unable to establish master SSH connection: master process exited
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
That's the error from ssh->error