Skip to content

Commit cc6483c

Browse files
committed
Handle Bun priting loaded env variables on STDERR
Fix: #130
1 parent 6c1c228 commit cc6483c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/execjs/external_runtime.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def exec_runtime(filename)
207207
end
208208
else
209209
def exec_runtime(filename)
210-
io = IO.popen(binary.split(' ') << filename, **(@popen_options.merge({err: [:child, :out]})))
210+
io = IO.popen(binary.split(' ') << filename, **@popen_options)
211211
output = io.read
212212
io.close
213213

test/test_execjs.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ def test_call_with_complex_properties
5656
assert_equal 2, context.call("(function(bar) { return foo + bar })", 1)
5757
end
5858

59+
def test_call_with_env_file
60+
Dir.mktmpdir do |dir|
61+
Dir.chdir(dir) do
62+
# Bun prints on STDOUT when loading .env files
63+
File.write(".env", "FOO=BAR")
64+
assert_equal 2, ExecJS.eval("1 + 1")
65+
end
66+
end
67+
end
68+
5969
def test_call_with_this
6070
# Known bug: https://github.com/cowboyd/therubyrhino/issues/39
6171
skip if ExecJS.runtime.is_a?(ExecJS::RubyRhinoRuntime)

0 commit comments

Comments
 (0)