in reply to IO::Select & ssh problem

Don't know about your problem. What's the error? (include $! in your error message).

The following isn't very safe:

my $cmd1 = "cat /etc/passwd"; my $sshcmd = "/usr/bin/ssh -t -i \$HOME/.ssh/mypubkey -o 'StrictHostKe +yChecking no' user\@host $cmd1"; open(IFILE, "$sshcmd |") || die "Bad open";
my @cmd = (cat => ( '/etc/passwd', )); my @sshcmd = ('/usr/bin/ssh' => ( -t => (), -i => "$HOME/.ssh/mypubkey", -o => 'StrictHostKeyChecking no', 'user@host', @cmd )); open(my $fr_ssh, '-|', @sshcmd) or die("Can't fork and pipe: $!\n");

Replies are listed 'Best First'.
Re^2: IO::Select & ssh problem
by cmv (Chaplain) on Sep 18, 2009 at 18:52 UTC
    ikegami++ Thanks for your response.

    The output from $! is "Illegal seek"

    Am I doing something I'm not supposed to be doing? Can anyone else get this to work?

    Thanks

    -Craig

    Update:

    Also, I'm also seeing an error when I run the following code:
    ... my @cmd = (cat => ( '/etc/passwd' )); open(IFILE, '-|', @cmd) || die "Bad ssh open"; ...
    The error is: Can't use an undefined value as filehandle reference at ...

    The perl version being run is: v5.6.1 built for sun4-solaris-64int

    However, this code does run fine on perl 5.8

    Update 2:

    However, this seems to work:
    ... my @cmd = (cat => ( '/etc/passwd' )); open (IFILE, '-|') || exec @cmd; ...