Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/node_shell_read.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
*/

requireNodeFS = function() {
// We always initialize both of these together, so we can use
// either one as the indicator for them not being initialized.
if (!fs) {
// Use nodePath as the indicator for these not being initialized,
// since in some environments a global fs may have already been
// created.
if (!nodePath) {
fs = require('fs');
nodePath = require('path');
}
Expand Down
6 changes: 6 additions & 0 deletions tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -8408,6 +8408,12 @@ def test_node_js_system(self):
ret = self.run_process(config.NODE_JS + ['a.js'], stdout=PIPE).stdout
self.assertContained('OK', ret)

def test_node_eval(self):
self.run_process([EMCC, '-sENVIRONMENT=node', test_file('hello_world.c'), '-o', 'a.js', '-O3'])
js = open('a.js').read()
ret = self.run_process(config.NODE_JS + ['-e', js], stdout=PIPE).stdout
self.assertContained('hello, world!', ret)

def test_is_bitcode(self):
fname = 'tmp.o'

Expand Down