From 659ccdc8ad8372f1331fd3c76b98589d0de50a0e Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 15:00:32 +0300 Subject: [PATCH] Dry up version and target parsing --- ext/libv8/compiler/generic_compiler.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ext/libv8/compiler/generic_compiler.rb b/ext/libv8/compiler/generic_compiler.rb index 3031bf1..7588ff9 100644 --- a/ext/libv8/compiler/generic_compiler.rb +++ b/ext/libv8/compiler/generic_compiler.rb @@ -17,12 +17,12 @@ module Libv8 end def version - call('-v').output =~ version_regexp + version_string =~ version_regexp $1 end def target - call('-v').output =~ target_regexp + version_string =~ target_regexp $1 end @@ -31,11 +31,19 @@ module Libv8 end def call(*arguments) - Compiler::execute_command arguments.unshift(@command).push('2>&1').join(' ') + Compiler::execute_command arguments.unshift(@command).join(' ') end private + def version_string + begin + Compiler::version_string_of @command + rescue StandardError + nil + end + end + def version_regexp GENERIC_VERSION_REGEXP end