Module: GitBundle::Shell
- Included in:
- Commands::Push, Repository
- Defined in:
- lib/git_bundle/shell.rb
Instance Method Summary collapse
- #execute(*args, silence_err: false) ⇒ Object
- #execute_live(*args) ⇒ Object
- #execute_pipe(*args) ⇒ Object
Instance Method Details
#execute(*args, silence_err: false) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/git_bundle/shell.rb', line 20 def execute(*args, silence_err: false) puts args.map { |arg| "'#{arg}'" }.join(' ') if ENV['DEBUG'] == 'true' pipe_out, pipe_in = IO.pipe pipe_err_in = silence_err ? File::NULL : pipe_in system *args, out: pipe_in, err: pipe_err_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 |