Class: Gitw::Exec
- Inherits:
-
Object
- Object
- Gitw::Exec
- Defined in:
- lib/gitw/exec.rb
Overview
exec
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #commands ⇒ Object
- #exec ⇒ Object
-
#initialize(*commands, **options) ⇒ Exec
constructor
A new instance of Exec.
Constructor Details
#initialize(*commands, **options) ⇒ Exec
Returns a new instance of Exec.
9 10 11 12 |
# File 'lib/gitw/exec.rb', line 9 def initialize(*commands, **) @commands = commands @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
31 32 33 |
# File 'lib/gitw/exec.rb', line 31 def @options end |
Instance Method Details
#commands ⇒ Object
27 28 29 |
# File 'lib/gitw/exec.rb', line 27 def commands @commands.flatten.compact end |
#exec ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gitw/exec.rb', line 14 def exec # puts "EXEC (#{Dir.pwd})> #{commands} #{options}" stdout, stderr, exit_status = Open3.capture3(*commands, **) ExecResult.new(commands: commands, options: , status: exit_status, stdout: stdout, stderr: stderr) rescue StandardError => e ExecResult.from_exception(e, commands: commands, options: ) end |