Sha256: b617d237b7f9ae3b0a7bbf2f007fcacc30b564a3d635c371cc11d42d60ca7b03

Contents?: true

Size: 650 Bytes

Versions: 7

Compression:

Stored size: 650 Bytes

Contents

require 'io/console'

module GitBundle
  module Shell
    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

    def execute_live(*args)
      execute_pipe(*args).each_line { |line| puts line.chomp }
    end

    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
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
git-bundle-1.0.15 lib/git_bundle/shell.rb
git-bundle-1.0.14 lib/git_bundle/shell.rb
git-bundle-1.0.13 lib/git_bundle/shell.rb
git-bundle-1.0.12 lib/git_bundle/shell.rb
git-bundle-1.0.11 lib/git_bundle/shell.rb
git-bundle-1.0.10 lib/git_bundle/shell.rb
git-bundle-1.0.9 lib/git_bundle/shell.rb