Skip to content

Commit d614916

Browse files
committed
feat(pmjs): forcibly run the program module, discards the return value of the script
1 parent 89afe29 commit d614916

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

python/pythonmonkey/require.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,8 @@ def runProgramModule(filename, argv, extraPaths=[]):
409409
globalThis.__filename = fullFilename
410410
globalThis.__dirname = os.path.dirname(fullFilename)
411411
with open(fullFilename, encoding="utf-8", mode="r") as mainModuleSource:
412-
pm.eval(mainModuleSource.read(), {'filename': fullFilename})
412+
pm.eval(mainModuleSource.read(), {'filename': fullFilename, 'noScriptRval': True})
413+
# forcibly run in file mode. We shouldn't be getting the last statement of the script as the result value.
413414

414415
# The pythonmonkey require export. Every time it is used, the stack is inspected so that the filename
415416
# passed to createRequire is correct. This is necessary so that relative requires work. If the filename

0 commit comments

Comments
 (0)