File tree Expand file tree Collapse file tree 1 file changed +24
-5
lines changed Expand file tree Collapse file tree 1 file changed +24
-5
lines changed Original file line number Diff line number Diff line change 1
1
require 'pp'
2
+ require 'open3'
2
3
require 'rake/task'
3
4
require 'rake_tasks/selenium_rake/checks'
4
5
require 'rakelib/bazel/task'
@@ -11,15 +12,33 @@ module Bazel
11
12
12
13
cmd = %w[ bazel ] + [ kind , target ] + ( args || [ ] )
13
14
puts cmd . join ( " " )
14
-
15
+
15
16
if SeleniumRake ::Checks ::windows?
16
17
cmd = cmd + [ "2>&1" ]
17
18
cmd_line = cmd . join ( " " )
18
19
cmd_out = `#{ cmd_line } `
19
20
cmd_exit_code = $?. success?
20
21
else
21
- cmd_out = `#{ cmd_line } `
22
- cmd_exit_code = $?. success?
22
+ Open3 . popen2e ( *cmd ) do |stdin , stdouts , wait |
23
+ is_running = true
24
+ stdin . close
25
+ cmd_out = ''
26
+ while is_running
27
+ begin
28
+ pipes = IO . select ( [ stdouts ] )
29
+ if pipes . empty?
30
+ is_running = false
31
+ else
32
+ line = stdouts . readpartial ( 512 )
33
+ cmd_out << line
34
+ STDOUT . print line if verbose
35
+ end
36
+ rescue EOFError
37
+ is_running = false
38
+ end
39
+ end
40
+ cmd_exit_code = wait . value . exitstatus
41
+ end
23
42
end
24
43
25
44
puts cmd_out if verbose
@@ -28,9 +47,9 @@ module Bazel
28
47
29
48
block &.call ( cmd_out )
30
49
out_artifact = Regexp . last_match ( 1 ) if cmd_out =~ %r{\s +(bazel-bin/\S +)}
31
-
50
+
32
51
puts "#{ target } -> #{ out_artifact } " if out_artifact
33
52
out_artifact
34
53
end
35
54
end
36
- end
55
+ end
You can’t perform that action at this time.
0 commit comments