summaryrefslogtreecommitdiffstats
path: root/core/debugger/local_debugger.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-06-12 14:15:54 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-06-12 14:15:54 +0200
commite95decf34369ba1bc925c59dfc2d791254bf41d9 (patch)
tree88ada112917aafd38997409a03111c437d8a9134 /core/debugger/local_debugger.cpp
parent7b9df571b3b77130bfd8500654b2c53864ac7c57 (diff)
parent4ecad8dea30859a5acbac41fe0e647c7bb6a53cc (diff)
downloadredot-engine-e95decf34369ba1bc925c59dfc2d791254bf41d9.tar.gz
Merge pull request #78111 from sbarkeha/master
Fix infinite loop on EOF in the command line debugger
Diffstat (limited to 'core/debugger/local_debugger.cpp')
-rw-r--r--core/debugger/local_debugger.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/debugger/local_debugger.cpp b/core/debugger/local_debugger.cpp
index 623b1eb0ce..dc46ffc307 100644
--- a/core/debugger/local_debugger.cpp
+++ b/core/debugger/local_debugger.cpp
@@ -138,7 +138,7 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
// Cache options
String variable_prefix = options["variable_prefix"];
- if (line.is_empty()) {
+ if (line.is_empty() && !feof(stdin)) {
print_line("\nDebugger Break, Reason: '" + script_lang->debug_get_error() + "'");
print_line("*Frame " + itos(current_frame) + " - " + script_lang->debug_get_stack_level_source(current_frame) + ":" + itos(script_lang->debug_get_stack_level_line(current_frame)) + " in function '" + script_lang->debug_get_stack_level_function(current_frame) + "'");
print_line("Enter \"help\" for assistance.");
@@ -267,7 +267,8 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
print_line("Added breakpoint at " + source + ":" + itos(linenr));
}
- } else if (line == "q" || line == "quit") {
+ } else if (line == "q" || line == "quit" ||
+ (line.is_empty() && feof(stdin))) {
// Do not stop again on quit
script_debugger->clear_breakpoints();
script_debugger->set_depth(-1);