http://www.perlmonks.org?node_id=1088604


in reply to Strange behaviour with SSH command launched with open

If you have a look at the help for system it says :-

         If you'd like to manually inspect "system"'s failure, you can
            check all possible failure modes by inspecting $? like this:

                if ($? == -1) {
                    print "failed to execute: $!\n";
                }
                elsif ($? & 127) {
                    printf "child died with signal %d, %s coredump\n",
                        ($? & 127),  ($? & 128) ? 'with' : 'without';
                }
                else {
                    printf "child exited with value %d\n", $? >> 8;
                }

Which will give you 'child exited with value 255', so ssh failed returning -1, therefore check your ssh setup.

  • Comment on Re: Strange behaviour with SSH command launched with open

Replies are listed 'Best First'.
Re^2: Strange behaviour with SSH command launched with open
by smutel (Initiate) on Jun 04, 2014 at 10:54 UTC
    Thanks for your help. Another question: how can I display error message returning by the ssh command with open command. I tried 2>&1 but it seems to not work correctly. Regards, Samuel Mutel.

      I'm not sure, but IPC::Open3 might give you better results.

Re^2: Strange behaviour with SSH command launched with open
by smutel (Initiate) on Jun 04, 2014 at 13:02 UTC

    It's not exactly a question about perl :

    - Do you know if SSHD limit the number of concurrent process ?

    - Same question with open ?

    Regards,

    Samuel Mutel.