]> git.kaiwu.me - njs.git/commitdiff
Shell: revert -t option back to preserve backward compatibility.
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 1 Mar 2024 02:56:13 +0000 (18:56 -0800)
committerDmitry Volyntsev <xeioex@nginx.com>
Fri, 1 Mar 2024 02:56:13 +0000 (18:56 -0800)
The issue was introduced in cb3e068a511c.

external/njs_shell.c

index d5bc9bd76eeebad948c4fcff2e2a2d559ab9ab25..8ac1b3d79ee4a8b8476f1aef121632913dab9949 100644 (file)
@@ -726,6 +726,22 @@ njs_options_parse(njs_opts_t *opts, int argc, char **argv)
             opts->sandbox = 1;
             break;
 
+        case 't':
+            if (++i < argc) {
+                if (strcmp(argv[i], "module") == 0) {
+                    opts->module = 1;
+
+                } else if (strcmp(argv[i], "script") != 0) {
+                    njs_stderror("option \"-t\" unexpected source type: %s\n",
+                                 argv[i]);
+                    return NJS_ERROR;
+                }
+
+                break;
+            }
+
+            njs_stderror("option \"-t\" requires source type\n");
+            return NJS_ERROR;
         case 'v':
         case 'V':
             opts->version = 1;