This repository was archived by the owner on Jul 19, 2025. It is now read-only.
Commit 8c9b4e9
committed
Handle race condition in JRuby's capture3
capture3 on JRuby will assign a pid variable as the result of spawn[1].
It then passes that to Process.detach[2]. If the process in question has
exited between these two statements, Process.detach will return nil.
It can't be determined then if the process had succeeded or not. Rather
than always assuming an error, we use a heuristic: if the output
produced parses as valid JSON, we should consider it successful.
[1]: https://github.com/jruby/jruby/blob/master/lib/ruby/stdlib/open3.rb#L200
[2]: https://github.com/jruby/jruby/blob/master/lib/ruby/stdlib/open3.rb#L2011 parent 8028216 commit 8c9b4e9
File tree
2 files changed
+43
-0
lines changed- lib/cc/engine/analyzers
- spec/cc/engine/analyzers
2 files changed
+43
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
29 | 51 | | |
30 | 52 | | |
31 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
29 | 50 | | |
30 | 51 | | |
31 | 52 | | |
0 commit comments