Skip to content

Commit b164139

Browse files
committed
Fix dbg() under node to go to stderr
This was accidentally changed to stdout in #23999. Oops. Fixed: #24403
1 parent ebccc05 commit b164139

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/runtime_debug.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function dbg(...args) {
1818
var fs = require('fs');
1919
var utils = require('util');
2020
var stringify = (a) => typeof a == 'object' ? utils.inspect(a) : a;
21-
fs.writeSync(1, args.map(stringify).join(' ') + '\n');
21+
fs.writeSync(2, args.map(stringify).join(' ') + '\n');
2222
} else
2323
#endif
2424
// TODO(sbc): Make this configurable somehow. Its not always convenient for

test/test_other.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15029,7 +15029,11 @@ def test_dbg(self):
1502915029
self.emcc_args.append('--pre-js=pre.js')
1503015030
# Verify that, after initialization, dbg() messages are prefixed with
1503115031
# worker and thread ID.
15032-
self.do_runf('other/test_dbg.c', expected, regex=True)
15032+
self.do_runf('other/test_dbg.c', expected, interleaved_output=True, regex=True)
15033+
15034+
# Verify that, stdout does not contain dbg() messages (interleaved_output=True
15035+
# means we return stdout followed by stderr)
15036+
self.do_runf('other/test_dbg.c', 'hello, world!\nstart { foo: 1 }\n', interleaved_output=False)
1503315037

1503415038
# When assertions are disabled `dbg` function is not defined
1503515039
self.do_runf('other/test_dbg.c',

0 commit comments

Comments
 (0)