Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Open3.capture3 instead of Kernel.system in _run #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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