summaryrefslogtreecommitdiff
path: root/modules/script
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2022-01-15 15:36:50 -0800
committerPhilip Chimento <philip.chimento@gmail.com>2022-01-16 13:21:37 -0800
commit7abaa6caacf2cfbf4c544fb865b67515966047a6 (patch)
treee490c76d1acc7631e19a86a72ebadc939ebe2306 /modules/script
parentf1b47f2b25157e08766573d506ddafd164340b02 (diff)
downloadgjs-7abaa6caacf2cfbf4c544fb865b67515966047a6.tar.gz
debugger: Handle EOF at debugger prompt correctly
Previously, pressing Ctrl+D at the debugger prompt would log an internal error because repl() would return undefined at EOF. It looks like the code here was actually expecting null for EOF, but we also need to explicitly quit the debugger in the EOF case and not just return.
Diffstat (limited to 'modules/script')
-rw-r--r--modules/script/_bootstrap/debugger.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/script/_bootstrap/debugger.js b/modules/script/_bootstrap/debugger.js
index 6b5020fe..a61c2433 100644
--- a/modules/script/_bootstrap/debugger.js
+++ b/modules/script/_bootstrap/debugger.js
@@ -870,10 +870,12 @@ function repl() {
var cmd;
for (;;) {
cmd = readline();
- if (cmd === null)
- return null;
- else if (cmd === '')
+ if (cmd === null /* eof */) {
+ quitCommand();
+ return;
+ } else if (cmd === '') {
cmd = prevcmd;
+ }
try {
prevcmd = cmd;