Improving crazyfun-bazel integration for non-windows systems
require 'pp'
require 'rake/task'
+require 'rake_tasks/selenium_rake/checks'
require 'rakelib/bazel/task'
require 'rakelib/rake/dsl'
@@ -8,15 +9,22 @@ module Bazel
def execute(kind, args, target, &block)
verbose = Rake::FileUtilsExt.verbose_flag
- cmd = %w[bazel] + [kind, target] + (args || []) + ["2>&1"]
- cmd_line = cmd.join(" ")
- puts cmd_line
+ cmd = %w[bazel] + [kind, target] + (args || [])
+ puts cmd.join(" ")
+ if SeleniumRake::Checks::windows?
+ cmd = cmd + ["2>&1"]
+ cmd_line = cmd.join(" ")
cmd_out = `#{cmd_line}`
+ cmd_exit_code = $?.success?
+ else
+ cmd_out = `#{cmd_line}`
+ cmd_exit_code = $?.success?
+ end
puts cmd_out if verbose
- raise "#{cmd.join(' ')} failed with exit code: #{$?.success?}" if not $?.success?
+ raise "#{cmd.join(' ')} failed with exit code: #{cmd_exit_code}" if not cmd_exit_code
block&.call(cmd_out)
out_artifact = Regexp.last_match(1) if cmd_out =~ %r{\s+(bazel-bin/\S+)}
