Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Switched spec bpm runner to use Open3 - Untested

  • Loading branch information...
commit 5ead5dd777b7ace402446c0c6836213a7732e7a7 1 parent 37ab23f
@wagenet wagenet authored
Showing with 11 additions and 25 deletions.
  1. +11 −25 spec/support/cli.rb
View
36 spec/support/cli.rb
@@ -1,4 +1,5 @@
require 'bpm/cli/base'
+require 'open3'
module SpecHelpers
attr_reader :stdin, :stdout, :stderr
@@ -9,33 +10,18 @@ def bpm(*argv)
kill!
create_pipes
- @pid = Process.fork do
- Dir.chdir opts[:chdir] if opts[:chdir]
-
- unless ENV['DEBUG_CLI']
- @stdout.close
- STDOUT.reopen @stdout_child
-
- @stdin.close
- STDIN.reopen @stdin_child
-
- if opts[:track_stderr]
- @stderr.close
- STDERR.reopen @stderr_child
- end
- end
-
- env.each do |key, val|
- ENV[key] = val
- end
-
- BPM::CLI::Base.start(argv)
+ Open3.popen3(env, ["./bin/bpm", *argv]) do |stdin, stdout, stderr, thread|
+ @stdin_child = stdin
+ @stdout_child = stdout
+ @stderr_child = stderr
end
- @stdout_child.close
- @stdin_child.close
- @stderr_child.close
- @pid
+ if ENV['DEBUG_CLI']
+ puts @stdout_child.read
+ puts @stderr_child.read
+ @stdout_child.rewind
+ @stderr_child.rewind
+ end
end
def out_until_block(io = stdout)
Please sign in to comment.
Something went wrong with that request. Please try again.