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

Fix abort recursion #17

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion bin/dep
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ module Dep
end

def self.abort
abort("error: dep --help for more info")
Kernel::abort("error: dep --help for more info")
end
end
end
Expand Down
22 changes: 22 additions & 0 deletions test/dep.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,25 @@
assert list.libraries.include?(Dep::Lib.new("cutest", "2.0"))
end
end

# Dep::CLI
scope do
def silence_unless_raises
begin
original_stderr = $stderr.clone
$stderr.reopen(File.new('/dev/null', 'w'))
yield
rescue Exception
$stderr.reopen(original_stderr)
raise
ensure
$stdout.reopen(original_stderr)
end
end

test "abort doesn't raise an exception" do
silence_unless_raises do
Dep::CLI.abort
end
end
end