Skip to content

Commit 3dec1bc

Browse files
authored
tests: Ensure stderr/stdout files are closed in run_js. NFC (#17544)
We say `test_dlmalloc_modes` failures on windows after #17512 which this hopefully should address.
1 parent 5667b03 commit 3dec1bc

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ jobs:
491491
core2.test_em_asm_unicode
492492
core2.test_em_js
493493
core2.test_em_js_pthreads
494+
other.test_dlmalloc_modes
494495
other.test_c_preprocessor
495496
other.test_prejs_unicode
496497
other.test_em_js_side_module

test/common.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,7 @@ def run_js(self, filename, engine=None, args=None,
768768
else:
769769
stderr_file = self.in_dir('stderr')
770770
stderr = open(stderr_file, 'w')
771+
stdout = open(stdout_file, 'w')
771772
error = None
772773
timeout_error = None
773774
if not engine:
@@ -778,13 +779,17 @@ def run_js(self, filename, engine=None, args=None,
778779
engine = engine + self.v8_args
779780
try:
780781
jsrun.run_js(filename, engine, args,
781-
stdout=open(stdout_file, 'w'),
782+
stdout=stdout,
782783
stderr=stderr,
783784
assert_returncode=assert_returncode)
784785
except subprocess.TimeoutExpired as e:
785786
timeout_error = e
786787
except subprocess.CalledProcessError as e:
787788
error = e
789+
finally:
790+
stdout.close()
791+
if stderr != STDOUT:
792+
stderr.close()
788793

789794
# Make sure that we produced proper line endings to the .js file we are about to run.
790795
if not filename.endswith('.wasm'):

0 commit comments

Comments
 (0)