Skip to content

Commit 4d806cc

Browse files
authored
Merge pull request #15 from nobu/sync-envutil
Set Ruby parser if the given ruby accepts `--parser`
2 parents 64a5580 + 5c5501a commit 4d806cc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/envutil.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ def invoke_ruby(args, stdin_data = "", capture_stdout = false, capture_stderr =
225225

226226
args = [args] if args.kind_of?(String)
227227
# use the same parser as current ruby
228-
if args.none? { |arg| arg.start_with?("--parser=") }
228+
if (args.none? { |arg| arg.start_with?("--parser=") } and
229+
/^ +--parser=/ =~ IO.popen([rubybin, "--help"], &:read))
229230
args = ["--parser=#{current_parser}"] + args
230231
end
231232
pid = spawn(child_env, *precommand, rubybin, *args, opt)

0 commit comments

Comments
 (0)