test/helper.rb
# Shortcut for running the `hub` command in a subprocess. Returns
# STDOUT as a string. Pass it what you would normally pass `hub` on
# the command line, e.g.
#
# shell: hub clone rtomayko/tilt
#  test: hub("clone rtomayko/tilt")
#
# If a block is given it will be run in the child process before
# execution begins. You can use this to monkeypatch or fudge the
# environment before running hub.
Shortcut for running the `hub` command in a subprocess. Returns
STDOUT as a string. Pass it what you would normally pass `hub` on
the command line, e.g.

hub clone rtomayko/tilt
test: hub("clone rtomayko/tilt")

If a block is given it will be run in the child process before
execution begins. You can use this to monkeypatch or fudge the
environment before running hub.
Shortcut for running the ` hub ` command in a subprocess . Returns STDOUT as a string . Pass it what you would normally pass ` hub ` on the command line e . g . hub clone rtomayko / tilt test : hub ( " clone rtomayko / tilt " ) If a block is given it will be run in the child process before execution begins . You can use this to monkeypatch or fudge the environment before running hub .
def hub(args, input = nil)
    parent_read, child_write = IO.pipe
    child_read, parent_write = IO.pipe if input
    fork do
      yield if block_given?
      $stdin.reopen(child_read) if input
      $stdout.reopen(child_write)
      $stderr.reopen(child_write)
      Hub(args).execute
    end
    if input
      parent_write.write input
      parent_write.close
    end
    child_write.close
    parent_read.read
  end
def hub ( args , input = nil ) parent_read , child_write = IO . pipe child_read , parent_write = IO . pipe if input fork do yield if block_given? $stdin . reopen ( child_read ) if input $stdout . reopen ( child_write ) $stderr . reopen ( child_write ) Hub ( args ) . execute end if input parent_write . write input parent_write . close end child_write . close parent_read . read end
Shortcut for running the `hub` command in a subprocess.
Shortcut for running the ` hub ` command in a subprocess .
args
input