Dmitry Volyntsev
September 06, 2023 09:04PM
details: https://hg.nginx.org/njs/rev/1f0adb4b81da
branches:
changeset: 2192:1f0adb4b81da
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Wed Sep 06 18:02:50 2023 -0700
description:
Shell: fixed file error message on CLI without interactive mode.

This closes #669 issue on Github.

diffstat:

external/njs_shell.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 0f1e76ab9d45 -r 1f0adb4b81da external/njs_shell.c
--- a/external/njs_shell.c Tue Sep 05 18:15:14 2023 -0700
+++ b/external/njs_shell.c Wed Sep 06 18:02:50 2023 -0700
@@ -311,8 +311,20 @@ main(int argc, char **argv)
njs_vm_opt_init(&vm_options);

if (opts.file == NULL) {
- opts.file = (opts.command == NULL) ? (char *) "shell"
- : (char *) "string";
+ if (opts.command != NULL) {
+ opts.file = (char *) "string";
+ }
+
+#ifdef NJS_HAVE_READLINE
+ else if (opts.interactive) {
+ opts.file = (char *) "shell";
+ }
+#endif
+
+ if (opts.file == NULL) {
+ njs_stderror("file name is required in non-interactive mode\n");
+ goto done;
+ }
}

vm_options.file.start = (u_char *) opts.file;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Shell: fixed file error message on CLI without interactive mode.

Dmitry Volyntsev 401 September 06, 2023 09:04PM



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

Online Users

Guests: 107
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready