summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-03 14:20:36 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-03 14:20:36 +0900
commit4d75346187557ae59736ca5739bfae312c285e08 (patch)
treea187ff879ef3e3d5afccab142b1242629057b8e9 /tool
parentec0d742dd744b13e89d82ffc88d193f165942acf (diff)
Refine error message
Highlight failed command and suggest installing the command. [Bug #16042]
Diffstat (limited to 'tool')
-rwxr-xr-xtool/pure_parser.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/tool/pure_parser.rb b/tool/pure_parser.rb
index 4d5e86e543..9ab663830e 100755
--- a/tool/pure_parser.rb
+++ b/tool/pure_parser.rb
@@ -4,7 +4,12 @@ BEGIN {
colorize = Colorize.new
file = ARGV.shift
- unless /\Abison .* (\d+)\.\d+/ =~ IO.popen(ARGV+%w[--version], &:read)
+ begin
+ version = IO.popen(ARGV+%w[--version], &:read)
+ rescue Errno::ENOENT
+ abort "Failed to run `#{colorize.fail ARGV.join(' ')}'; You may have to install it."
+ end
+ unless /\Abison .* (\d+)\.\d+/ =~ version
puts colorize.fail("not bison")
exit
end