net-ssh-w32perl stdout hangup problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I'm running ActivePerl 5.8.6 build 811 and have been trying to get a
simple script using net-ssh-w32perl (0.05) to run on a Windows XP SP1
platform.  I suspect there is an issue with stdout for the following

(1) I can run the following code without any problem:
=> as long as any stdout gets redirected.
my($host, $username, $new_password, $old_password);
$host = ''
$username = 'blah';
$old_password = 'secret';

use strict;
use Net::SSH::W32Perl;

## Create a Net::SSH::Perl object and login to the remote host.

my %args;
$args = 1;
$args = 2;

my $ssh = new Net::SSH::W32Perl($host, %args);
$ssh->login($username, $old_password);
my ($stdout, $stderr, $exit) = $ssh->cmd('ls > /tmp/foo.out',"\n");

(2) As soon as I change the last line to this, it hangs:

my ($stdout, $stderr, $exit) = $ssh->cmd('ls',"\n");

(3) This is the output I receive:

Reading configuration data C:\Documents and Settings\myname/.ssh/con
Reading configuration data /etc/ssh_config
Connecting to, port 22.
Socket created, turning on blocking...
Remote protocol version 2.0, remote software version OpenSSH_3.4p1
Net::SSH::Perl Version 1.27, protocol version 2.0.
No compat match: OpenSSH_3.4p1.
Connection established.
Sent key-exchange init (KEXINIT), wait response.
Algorithms, c->s: 3des-cbc hmac-sha1 none
Algorithms, s->c: 3des-cbc hmac-sha1 none
Entering Diffie-Hellman Group 1 key exchange.
Sent DH public key, waiting for reply.
Received host key, type 'ssh-dss'.
Host '' is known and matches the host key.
Computing shared secret key.
Verifying server signature.
Waiting for NEWKEYS message.
Enabling incoming encryption/MAC/compression.
Send NEWKEYS, enable outgoing encryption/MAC/compression.
Sending request for user-authentication service.
Service accepted: ssh-userauth.
Trying empty user-authentication request.
Authentication methods that can continue: publickey,password.
Next method to try is publickey.
Trying pubkey authentication with key file 'C:\Documents and Settings
Login completed, opening dummy shell channel.
channel 0: new [client-session]
Requesting channel_open for channel 0.
channel 0: open confirm rwindow 0 rmax 32768
Got channel open confirmation, requesting shell.
Requesting service shell on channel 0.
channel 1: new [client-session]
Requesting channel_open for channel 1.
Entering interactive session.
Sending command: ls
Requesting service exec on channel 1.
channel 1: send eof
channel 1: open confirm rwindow 131071 rmax 32768
=======> Hangs Here.

When it runs OK (with the stdout redirect) I get this:

Sending command: ls
Requesting service exec on channel 1.
channel 1: send eof
channel 1: open confirm rwindow 131071 rmax 32768
channel 1: rcvd eof
channel 1: output open -> drain
channel 1: obuf empty
channel 1: output drain -> closed
channel 1: close_write
channel 1: send close
input_channel_request: rtype exit-status reply 0
channel 1: rcvd close
channel 1: full closed
=======> script exits normally

I would appreciate any help!! I've probably spent 10 hours so far just
getting all the requisite modules in place, then uninstalling and
re-installing Active Perl just to be sure something wasn't corrupted.

Thanks :)

Site Timeline