I\'m trying to manage a SSH connection to a network device via the PTY module, with a code similar to this:
cmd_line = \"ssh coltrane@love.supreme.com\"
begin
Ok, here are some possible solutions for this problem :
use ruby 1.9.2 PTY.check() method
wrap the command line in a script
Unfortunately I can't use the latest version of ruby as so I used the wrapper solution, that echoes $? to a file at the end of the wrapper script. The exit code is read when the spawned child exits.
Of course if something interrupts the execution of the wrapper script itself, then we'll never get the result file ...
But at least this workaround can be used for 1.8.7/1.9.1 versions of Ruby