Class: GitHub::Command::Shell
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#out ⇒ Object
readonly
Returns the value of attribute out.
Instance Method Summary collapse
- #command ⇒ Object
- #error? ⇒ Boolean
-
#initialize(*command) ⇒ Shell
constructor
A new instance of Shell.
- #out? ⇒ Boolean
- #run ⇒ Object
Constructor Details
#initialize(*command) ⇒ Shell
Returns a new instance of Shell.
95 96 97 |
# File 'lib/github/command.rb', line 95 def initialize(*command) @command = command end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
92 93 94 |
# File 'lib/github/command.rb', line 92 def error @error end |
#out ⇒ Object (readonly)
Returns the value of attribute out.
93 94 95 |
# File 'lib/github/command.rb', line 93 def out @out end |
Instance Method Details
#command ⇒ Object
114 115 116 |
# File 'lib/github/command.rb', line 114 def command @command.join(' ') end |
#error? ⇒ Boolean
118 119 120 |
# File 'lib/github/command.rb', line 118 def error? !!@error end |
#out? ⇒ Boolean
122 123 124 |
# File 'lib/github/command.rb', line 122 def out? !!@out end |
#run ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/github/command.rb', line 99 def run GitHub.debug "sh: #{command}" out = err = nil Open3.popen3(*@command) do |_, pout, perr| out = pout.read.strip err = perr.read.strip end replace @error = err if !err.empty? replace @out = out if !out.empty? self end |