in reply to ssh2 channel/exec issue

After much testing and log review I finally figured this out. I previously tried creating a non-blocking shell, and then writing to the shell, but was getting the same result as the above code. From looking through logs on CUCM I did notice that the script was creating tty=unknown shell. After setting the tty (->pty(1)), I was finally able to work everything out.

my $channel = $ssh2->channel(); $channel->blocking(0); $channel->pty(1); #set tty $channel->shell(); sleep 10; #required as the CUCM CLI is slow to start $channel->write("show account\n"); sleep 5; #Again the CLI is kind of slow my $output; $channel->read($output,128); print "Account details:\n $output\n";