in reply to Special Characters_CommandOutput
In the documentation for Net::OpenSSH I noticed they don't use the capture or die construct but instead check for the error on a seperate line. This made sense once I found the description of what happens during a capture if there is an error. It goes ahead and returns what it has captured so far so the or die... won't be triggered.
When an error happens while capturing (for instance, the operation times out), the partial captured output will be returned. Error conditions have to be explicitly checked using the "error" method. For instance:my $output = $ssh->capture({ timeout => 10 }, "echo hello; sleep 20; echo bye"); $ssh->error and warn "operation didn't complete successfully: ". $ssh->error; print $output;
Try replacing this line
with this and see what happens. I've never used this module but the timeout options might be worth investigating.@output = $ssh->capture($CommandE) or die "remote command failed: +" . $ssh-> +error;
@output = $ssh->capture($CommandE); $ssh->error and die "remote command failed or didn't complete successfully: " +. $ssh->error;
There is also the capture2 function to capture both STDERR and STDOUT. I couldn't tell from your command prompt version of the output if there was anything going to STDOUT.
Edit: PS If you put your command output text into code tags<code> ...[text]...</code> then it will just be text and brackets won't be interpreted as links. It will be much easier for us to understand what is going on.
Edit: Using capture with Net::OpenSSH on Cisco routers came up in this node. It looks like salva had some good suggestions.
|
|---|