Skip to content

Commit 447c952

Browse files
committed
EnvUtil for parallel sweep
1 parent 3648bd7 commit 447c952

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

tool/lib/envutil.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def invoke_ruby(args, stdin_data = "", capture_stdout = false, capture_stderr =
243243
# enable parallel sweep if current ruby has it enabled
244244
if (current_parallel_sweep? and
245245
args.none? { |arg| arg =~ /--disable[-=]parallel[-_]sweep/ } and
246-
/^ +parallel-sweep/ =~ (rubybin_help ||= IO.popen([rubybin, "--help"], &:read)))
246+
/^ +parallel-sweep/i =~ (rubybin_help ||= IO.popen([rubybin, "--help"], &:read)))
247247
args = ["--enable-parallel-sweep"] + args
248248
end
249249
pid = spawn(child_env, *precommand, rubybin, *args, opt)
@@ -293,14 +293,16 @@ def invoke_ruby(args, stdin_data = "", capture_stdout = false, capture_stderr =
293293
end
294294
module_function :invoke_ruby
295295

296+
RUBY_DESC_FEATURES_PAT = %r{\)\K [-+*/%._0-9a-zA-Z\[\] ]*(?=\[[-+*/%._0-9a-zA-Z]+\]\z)}
297+
296298
def current_parser
297-
features = RUBY_DESCRIPTION[%r{\)\K [-+*/%._0-9a-zA-Z\[\] ]*(?=\[[-+*/%._0-9a-zA-Z]+\]\z)}]
299+
features = RUBY_DESCRIPTION[RUBY_DESC_FEATURES_PAT]
298300
features&.split&.include?("+PRISM") ? "prism" : "parse.y"
299301
end
300302
module_function :current_parser
301303

302304
def current_parallel_sweep?
303-
features = RUBY_DESCRIPTION[%r{\)\K [-+*/%._0-9a-zA-Z\[\] ]*(?=\[[-+*/%._0-9a-zA-Z]+\]\z)}]
305+
features = RUBY_DESCRIPTION[RUBY_DESC_FEATURES_PAT]
304306
features&.split&.include?("+Parallel-Sweep")
305307
end
306308
module_function :current_parallel_sweep?

0 commit comments

Comments
 (0)