ref: 3430d9a06d6f8a3696e2bbdca7681937e60ca7a9
parent: c86267d8b2b5f9a6ae318dc69886109eee0c7b61
author: Tor Andersson <tor.andersson@artifex.com>
date: Mon Aug 27 08:57:12 EDT 2018
Return null instead of throwing an error when readline hits EOF.
--- a/main.c
+++ b/main.c
@@ -120,8 +120,10 @@
static void jsB_readline(js_State *J)
{
char *line = readline("");
- if (!line)
- js_error(J, "cannot read line from stdin");
+ if (!line) {
+ js_pushnull(J);
+ return;
+ }
js_pushstring(J, line);
if (*line)
add_history(line);