Module: GitBundle::Shell
- Included in:
- Commands::Push, Repository
- Defined in:
- lib/git_bundle/shell.rb
Instance Method Summary collapse
Instance Method Details
#execute(*args) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/git_bundle/shell.rb', line 20 def execute(*args) puts args.map { |arg| "'#{arg}'" }.join(' ') if ENV['DEBUG'] == 'true' pipe_out, pipe_in = IO.pipe system *args, out: pipe_in, err: pipe_in pipe_in.close pipe_out.read end |
#execute_live(*args) ⇒ Object
16 17 18 |
# File 'lib/git_bundle/shell.rb', line 16 def execute_live(*args) execute_pipe(*args).each_line { |line| puts line.chomp } end |
#execute_pipe(*args) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/git_bundle/shell.rb', line 5 def execute_pipe(*args) puts args.map { |arg| "'#{arg}'" }.join(' ') if ENV['DEBUG'] == 'true' pipe_out, pipe_in = IO.pipe fork do system *args, out: pipe_in, err: pipe_in end pipe_in.close pipe_out end |