Dmitry Volyntsev
December 26, 2019 06:56AM
details: https://hg.nginx.org/njs/rev/5fbc49bc5a7e
branches:
changeset: 1291:5fbc49bc5a7e
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Thu Dec 26 14:53:52 2019 +0300
description:
Shell: stopping events handling for uncaught exception in file mode.

This closes #269 issue on Github.

diffstat:

src/njs_shell.c | 8 ++++++++
test/njs_expect_test.exp | 11 +++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)

diffs (46 lines):

diff -r 0f31637138ce -r 5fbc49bc5a7e src/njs_shell.c
--- a/src/njs_shell.c Fri Dec 13 12:47:37 2019 +0800
+++ b/src/njs_shell.c Thu Dec 26 14:53:52 2019 +0300
@@ -809,6 +809,10 @@ njs_process_script(njs_opts_t *opts, njs

njs_output(opts, vm, ret);

+ if (!opts->interactive && ret == NJS_ERROR) {
+ return NJS_ERROR;
+ }
+
for ( ;; ) {
if (!njs_vm_pending(vm)) {
break;
@@ -833,6 +837,10 @@ njs_process_script(njs_opts_t *opts, njs

if (ret == NJS_ERROR) {
njs_output(opts, vm, ret);
+
+ if (!opts->interactive) {
+ return NJS_ERROR;
+ }
}
}

diff -r 0f31637138ce -r 5fbc49bc5a7e test/njs_expect_test.exp
--- a/test/njs_expect_test.exp Fri Dec 13 12:47:37 2019 +0800
+++ b/test/njs_expect_test.exp Thu Dec 26 14:53:52 2019 +0300
@@ -699,6 +699,17 @@ njs_test {
"Error: Not a directory*"}
}

+njs_run {"-c" "setTimeout(() => {console.log('A'.repeat(1024))}, 0); ref"} \
+"^Thrown:
+ReferenceError: \"ref\" is not defined in string:1
+ at main \\\(native\\\)\n$"
+
+njs_run {"-c" "setTimeout(() => {ref}, 0); setTimeout(() => {console.log('A'.repeat(1024))}, 0)"} \
+"^Thrown:
+ReferenceError: \"ref\" is not defined in string:1
+ at anonymous \\\(native\\\)
+ at main \\\(native\\\)\n$"
+
# Modules

njs_run {"-p" "test/module/libs" "./test/module/normal.js"} \
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Shell: stopping events handling for uncaught exception in file mode.

Dmitry Volyntsev 186 December 26, 2019 06:56AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 96
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready