Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fewer warnings #23

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 36 additions & 36 deletions lib/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def Session.description
@debug = ENV['SESSION_DEBUG']

class << self
attr :track_history, true
attr :use_spawn, true
attr :use_open3, true
attr :debug, true
attr_accessor :track_history
attr_accessor :use_spawn
attr_accessor :use_open3
attr_accessor :debug
def new(*a, &b)
Sh::new(*a, &b)
end
Expand All @@ -45,19 +45,19 @@ def cmdno= n; @cmdno = n; end
end

# attributes
attr :cmd
attr :cmdno
attr :out,true
attr :err,true
attr :cid
attr :begin_out
attr :end_out
attr :begin_out_pat
attr :end_out_pat
attr :begin_err
attr :end_err
attr :begin_err_pat
attr :end_err_pat
attr_reader :cmd
attr_reader :cmdno
attr_accessor :out
attr_accessor :err
attr_reader :cid
attr_reader :begin_out
attr_reader :end_out
attr_reader :begin_out_pat
attr_reader :end_out_pat
attr_reader :begin_err
attr_reader :end_err
attr_reader :begin_err_pat
attr_reader :end_err_pat

def initialize(command)
@cmd = command.to_s
Expand Down Expand Up @@ -100,10 +100,10 @@ def default_prog
def default_prog= prog
@default_prog = prog
end
attr :track_history, true
attr :use_spawn, true
attr :use_open3, true
attr :debug, true
attr_accessor :track_history
attr_accessor :use_spawn
attr_accessor :use_open3
attr_accessor :debug
def init
@track_history = nil
@use_spawn = nil
Expand All @@ -117,23 +117,23 @@ def init
init

# attributes
attr :opts
attr :prog
attr :stdin
attr_reader :opts
attr_reader :prog
attr_reader :stdin
alias i stdin
attr :stdout
attr_reader :stdout
alias o stdout
attr :stderr
attr_reader :stderr
alias e stderr
attr :history
attr :track_history
attr :outproc, true
attr :errproc, true
attr :use_spawn
attr :use_open3
attr :debug, true
attr_reader :history
attr_reader :track_history
attr_accessor :outproc
attr_accessor :errproc
attr_reader :use_spawn
attr_reader :use_open3
attr_accessor :debug
alias debug? debug
attr :threads
attr_reader :threads

# instance methods
def initialize(*args)
Expand Down Expand Up @@ -355,7 +355,7 @@ def execute(command, redirects = {})
:mutex => mutex,
}

begin
begin
# send command in the background so we can begin processing output
# immediately - thanks to tanaka akira for this suggestion
threads << Thread::new { send_command cmd }
Expand Down Expand Up @@ -446,7 +446,7 @@ class Sh < AbstractSession
DEFAULT_PROG = 'sh'
ECHO = 'echo'

attr :status
attr_reader :status
alias exit_status status
alias exitstatus status

Expand Down
5 changes: 2 additions & 3 deletions test/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def timeout n
end
ensure
begin; Process.kill 'SIGQUIT', cid; rescue Exception; end
begin; Process.wait; rescue Exception => e; end
begin; Process.wait; rescue Exception; end
trap 'SIGUSR1', handler if defined? handler
end
end
Expand Down Expand Up @@ -71,8 +71,7 @@ module Session
class Test < Test::Unit::TestCase
def test_0
#{{{
sh = nil
assert_nothing_raised { sh = Shell.new }
assert_nothing_raised { Shell.new }
#}}}
end
def test_1
Expand Down