Skip to content

Commit 336fa45

Browse files
ossy-szegedrerobika
authored andcommitted
Make REPL option parser handle "-" option properly (#3384)
REPL could read JS file from standard input when we passed "-" option, but after #1896 "-" became invalid option mistakenly. JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác [email protected]
1 parent c5ed46f commit 336fa45

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

jerry-main/cli.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ cli_consume_option (cli_state_t *state_p) /**< state of the command line option
112112

113113
state_p->arg = arg;
114114

115-
if (arg[0] != '-')
115+
if (arg[0] != '-' || (arg[0] == '-' && arg[1] == '\0'))
116116
{
117117
return CLI_OPT_DEFAULT;
118118
}

jerry-main/main-unix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ static const cli_opt_t main_opts[] =
366366
CLI_OPT_DEF (.id = OPT_NO_PROMPT, .longopt = "no-prompt",
367367
.help = "don't print prompt in REPL mode"),
368368
CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = "FILE",
369-
.help = "input JS file(s)")
369+
.help = "input JS file(s) (If file is -, read standard input.)")
370370
};
371371

372372
/**

0 commit comments

Comments
 (0)