diff options
author | Rich Trott <rtrott@gmail.com> | 2018-09-21 11:55:55 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-10-02 13:07:18 -0700 |
commit | 83d0404971471b3d4f711ba9690394e9df54eb5f (patch) | |
tree | 9809b34f0a87cb54ba4eaddca0c8ec64ba0bed4f /test/parallel/test-repl-tab-complete-nested-repls.js | |
parent | b3b3f53a339135903133842888467a0e6798acd0 (diff) | |
download | android-node-v8-83d0404971471b3d4f711ba9690394e9df54eb5f.tar.gz android-node-v8-83d0404971471b3d4f711ba9690394e9df54eb5f.tar.bz2 android-node-v8-83d0404971471b3d4f711ba9690394e9df54eb5f.zip |
repl: do not swallow errors in nested REPLs
For tab completion, a REPLServer instance will sometimes create another
REPLServer instance. If a callback is sent to the `.complete()` function
and that callback throws an error, it will be swallowed by the nested
REPLs domain. Re-throw the error so that processes don't silently exit
without any indication of an error (including a status code).
Fixes: https://github.com/nodejs/node/issues/21586
PR-URL: https://github.com/nodejs/node/pull/23004
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-repl-tab-complete-nested-repls.js')
-rw-r--r-- | test/parallel/test-repl-tab-complete-nested-repls.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/parallel/test-repl-tab-complete-nested-repls.js b/test/parallel/test-repl-tab-complete-nested-repls.js new file mode 100644 index 0000000000..36547e8d9f --- /dev/null +++ b/test/parallel/test-repl-tab-complete-nested-repls.js @@ -0,0 +1,21 @@ +// Tab completion sometimes uses a separate REPL instance under the hood. +// That REPL instance has its own domain. Make sure domain errors trickle back +// up to the main REPL. +// +// Ref: https://github.com/nodejs/node/issues/21586 + +'use strict'; + +require('../common'); +const fixtures = require('../common/fixtures'); + +const assert = require('assert'); +const { spawnSync } = require('child_process'); + +const testFile = fixtures.path('repl-tab-completion-nested-repls.js'); +const result = spawnSync(process.execPath, [testFile]); + +// The spawned process will fail. In Node.js 10.11.0, it will fail silently. The +// test here is to make sure that the error information bubbles up to the +// calling process. +assert.ok(result.status, 'testFile swallowed its error'); |