Skip to content

Commit

Permalink
Moves from _run using Kernel.system to Open3.capture3 (fixes guard#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
RickR committed Mar 24, 2017
1 parent b7946a0 commit 15a08cc
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 56 deletions.
10 changes: 7 additions & 3 deletions lib/guard/minitest/runner.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'guard/minitest/inspector'
require 'English'
require 'open3'

module Guard
class Minitest < Plugin
Expand Down Expand Up @@ -40,7 +41,7 @@ def run(paths, options = {})

begin
status = _run_possibly_bundled_command(paths, options[:all])
rescue Errno::ENOENT => e
rescue RuntimeError, Errno::ENOENT => e
Compat::UI.error e.message
throw :task_has_failed
end
Expand Down Expand Up @@ -124,9 +125,12 @@ def autorun?

def _run(*args)
Compat::UI.debug "Running: #{args.join(' ')}"
return $CHILD_STATUS.exitstatus unless Kernel.system(*args).nil?
out, err, st = Open3.capture3(*args)
return st.exitstatus unless st.exitstatus.nil?

fail Errno::ENOENT, args.join(' ')
fail "Failed to execute #{args.join}, #{st}"
rescue Errno::ENOENT => e
fail Errno::ENOENT, args.join
end

def _run_possibly_bundled_command(paths, all)
Expand Down
Loading

0 comments on commit 15a08cc

Please sign in to comment.