def get_exit_code #:nodoc:
      cmd = options[:override_get_exit_code] || 'echo $?'
      if cmd.respond_to?(:call)
        cmd.call(self)
      else
        debug 'Retrieving exit code from last command...'
        discard_local_buffer do
          send_data cmd + line_ending
          wait_for_prompt 1, 2
          ret = command_output(cmd).strip.to_i
        end
        debug 'Exit code: ' + ret.to_s
        ret
      end
    end
def get_exit_code #:nodoc:
      cmd = options[:override_get_exit_code] || 'echo $?'
      if cmd.respond_to?(:call)
        cmd.call(self)
      else
        debug 'Retrieving exit code from last command...'
        discard_local_buffer do
          send_data cmd + line_ending
          wait_for_prompt 1, 2
          ret = command_output(cmd).strip.to_i
        end
        debug 'Exit code: ' + ret.to_s
        ret
      end
    end
Gets an exit code by echoing the $? variable from the environment.

 This can be overridden by specifying either a string command or a Proc
 for the :override_get_exit_code option in the shell's options.