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.
119 120 121 |
# File 'lib/github/command.rb', line 119 def initialize(*command) @command = command end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
116 117 118 |
# File 'lib/github/command.rb', line 116 def error @error end |
#out ⇒ Object (readonly)
Returns the value of attribute out.
117 118 119 |
# File 'lib/github/command.rb', line 117 def out @out end |
Instance Method Details
#command ⇒ Object
138 139 140 |
# File 'lib/github/command.rb', line 138 def command @command.join(' ') end |
#error? ⇒ Boolean
142 143 144 |
# File 'lib/github/command.rb', line 142 def error? !!@error end |
#out? ⇒ Boolean
146 147 148 |
# File 'lib/github/command.rb', line 146 def out? !!@out end |
#run ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/github/command.rb', line 123 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 unless err.empty? replace @out = out unless out.empty? self end |