class Session::AbstractSession

def initialize(*args)

instance methods
def initialize(*args)
  @opts = hashify(*args)
  @prog = getopt('prog', opts, getopt('program', opts, self.class::default_prog))
  raise(ArgumentError, "no program specified") unless @prog
  @track_history = nil
  @track_history = Session::track_history unless Session::track_history.nil?
  @track_history = self.class::track_history unless self.class::track_history.nil?
  @track_history = getopt('history', opts) if hasopt('history', opts) 
  @track_history = getopt('track_history', opts) if hasopt('track_history', opts) 
  @use_spawn = nil
  @use_spawn = Session::use_spawn unless Session::use_spawn.nil?
  @use_spawn = self.class::use_spawn unless self.class::use_spawn.nil?
  @use_spawn = getopt('use_spawn', opts) if hasopt('use_spawn', opts)
  if defined? JRUBY_VERSION
    @use_open3 = true
  else
    @use_open3 = nil
    @use_open3 = Session::use_open3 unless Session::use_open3.nil?
    @use_open3 = self.class::use_open3 unless self.class::use_open3.nil?
    @use_open3 = getopt('use_open3', opts) if hasopt('use_open3', opts)
  end
  @debug = nil
  @debug = Session::debug unless Session::debug.nil?
  @debug = self.class::debug unless self.class::debug.nil?
  @debug = getopt('debug', opts) if hasopt('debug', opts) 
  @history = nil
  @history = History::new if @track_history 
  @outproc = nil
  @errproc = nil
  @stdin, @stdout, @stderr =
    if @use_spawn
      Spawn::spawn @prog
    elsif @use_open3
      Open3::popen3 @prog
    else
      __popen3 @prog
    end
  @threads = []
  clear
  if block_given?
    ret = nil
    begin
      ret = yield self
    ensure
      self.close!
    end
    return ret
  end
  return self
end