Open solb opened 7 months ago
@lucacasonato @solb it was resolved.
My earlier test was on Debian, and I just saw the same issue with Deno 2 RC7 on Termux atop Android. Your screenshot makes it look like you tested on Windows; are you sure it hasn't only been fixed there?
@solb I tried it in another version before and noticed the issue, however in the newest it was fixed, so you can pull the latest source and try.
Maybe it is still not released in the newest release.
Running the following command and pressing Ctrl+D to close the standard input stream reveals that the built-in
prompt()
function outputs a newline in this case:Surprisingly,
confirm()
does not exhibit this behavior (note the location of the second$
prompt):I would argue that the latter response is more correct, by analogy with C. Consider the following POSIX.1-2008–compliant program:
Hitting Ctrl+D elicits the
confirm()
-style behavior on my GNU/Linux system:I noticed this inconsistency when filing #22955: it is responsible for the extra newline in the final command-line example in that issue. I haven't traced the issue deeper than
prompt()
's use ofop_read_line_prompt()
(in contrast toconfirm()
'sreadLineFromStdinSync()
) inruntime/js/41_prompt.js
.Tested on this official release build: