[gjs: 14/15] debugger: Handle EOF at debugger prompt correctly
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 14/15] debugger: Handle EOF at debugger prompt correctly
- Date: Sun, 16 Jan 2022 21:28:17 +0000 (UTC)
commit 7abaa6caacf2cfbf4c544fb865b67515966047a6
Author: Philip Chimento <philip chimento gmail com>
Date: Sat Jan 15 15:36:50 2022 -0800
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.
gjs/debugger.cpp | 2 +-
modules/script/_bootstrap/debugger.js | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gjs/debugger.cpp b/gjs/debugger.cpp
index 5d815c8f3..e3e777be0 100644
--- a/gjs/debugger.cpp
+++ b/gjs/debugger.cpp
@@ -82,7 +82,7 @@ static bool do_readline(JSContext* cx, unsigned argc, JS::Value* vp) {
/* EOF, return null */
if (!line) {
- args.rval().setUndefined();
+ args.rval().setNull();
return true;
}
} while (line && line.get()[0] == '\0');
diff --git a/modules/script/_bootstrap/debugger.js b/modules/script/_bootstrap/debugger.js
index 6b5020fe3..a61c24337 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]