diff options
author | Anna Henningsen <anna@addaleax.net> | 2020-01-21 20:30:35 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-01-23 22:39:00 +0100 |
commit | 32e7e813e93ec3d0625d315658288769e448dd99 (patch) | |
tree | 9479d9ed447e6a75b158a43a558e3aadb2b1db63 /test/message | |
parent | 9cc747bfcea131797fbf0fcc805f1d7fa244b7da (diff) | |
download | node-new-32e7e813e93ec3d0625d315658288769e448dd99.tar.gz |
src: use custom fprintf alike to write errors to stderr
This allows printing errors that contain nul characters, for example.
Fixes: https://github.com/nodejs/node/issues/28761
Fixes: https://github.com/nodejs/node/issues/31218
PR-URL: https://github.com/nodejs/node/pull/31446
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/message')
-rw-r--r-- | test/message/error_with_nul.js | 11 | ||||
-rw-r--r-- | test/message/error_with_nul.out | bin | 0 -> 549 bytes |
2 files changed, 11 insertions, 0 deletions
diff --git a/test/message/error_with_nul.js b/test/message/error_with_nul.js new file mode 100644 index 0000000000..2849e9d21c --- /dev/null +++ b/test/message/error_with_nul.js @@ -0,0 +1,11 @@ +'use strict'; +require('../common'); + +function test() { + const a = 'abc\0def'; + console.error(a); + throw new Error(a); +} +Object.defineProperty(test, 'name', { value: 'fun\0name' }); + +test(); diff --git a/test/message/error_with_nul.out b/test/message/error_with_nul.out Binary files differnew file mode 100644 index 0000000000..396d94debf --- /dev/null +++ b/test/message/error_with_nul.out |