-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command line debugger enters infinite loop on Ctrl+D (end of transmission) character #50170
Comments
I did some digging and here is what I found: Affected platformsI cannot reproduce this issue on Windows. On Windows, using the python repl for reference, I wasn't able to reproduce this issue in powershell or git-bash. The windows equivalent of Ctrl+D is Ctrl+Z (to exit python you can use Ctrl+Z + return). This had no effect on the command line debugger. In git-bash Ctrl+C and Ctrl+Z don't appear to work at all, either when using the command line debugger or python. CausesThe debugger repl runs a godot/core/script_debugger_local.cpp Lines 53 to 57 in 7610409
godot/drivers/unix/os_unix.cpp Lines 149 to 159 in 7610409
In the case of Ctrl+C, However, after encountering EOF, any subsequent calls to godot/core/script_debugger_local.cpp Lines 61 to 65 in 7610409
Possible solutionsThis patch to 3.3.2-stable (tested on linux) will cause the debugger to exit on Ctrl+D (on *nix platforms). It also changes the behavior of the debugger to exit on Ctrl+C (on *nix and presumably windows platforms) which would resolve #19775 if this is the desired behavior: diff --git a/core/script_debugger_local.cpp b/core/script_debugger_local.cpp
index 3cc14daf4c..7ccec46033 100644
--- a/core/script_debugger_local.cpp
+++ b/core/script_debugger_local.cpp
@@ -53,7 +53,14 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
while (true) {
OS::get_singleton()->print("debug> ");
- String line = OS::get_singleton()->get_stdin_string().strip_edges();
+ String line = OS::get_singleton()->get_stdin_string();
+
+ if (line == "") {
+ print_line("");
+ line = "quit";
+ } else {
+ line = line.strip_edges();
+ }
// Cache options
String variable_prefix = options["variable_prefix"]; |
I stumbled upon this as well in the past. I run tests using GitHub Actions in https://github.com/goostengine/goost/blob/2cf40249f90d198bf722002bf883f78fd93bbc72/.github/workflows/linux_builds.yml#L265-L267, and sometimes in case of script error the job keeps hanging for hours until the job finally stops. This also may produce huge logs files there, but looks like GitHub handles these kind of cases and cancels the job eventually. |
IMHO |
When using the command line debugger (godot -d) on Unix systems, when entering an EOF (ctrl+D), the debugger enters an infinite loop. Adding a check for EOF in the debugger loop exits the debugger when EOF is entered. Fixes godotengine#50170. (cherry picked from commit 4ecad8d)
When using the command line debugger (godot -d) on Unix systems, when entering an EOF (ctrl+D), the debugger enters an infinite loop. Adding a check for EOF in the debugger loop exits the debugger when EOF is entered. Fixes godotengine#50170. (cherry picked from commit 4ecad8d) (cherry picked from commit d1dcea7)
Godot version
3.3.2-stable
System information
NixOS 21.11
Issue description
Typing Ctrl+D at CLI debugger prompt results in an infinite loop which also starts filling the log file at
.local/share/godot/app_userdata/<project>/logs/godot.log
with a string of the following format (script path being project dependent):Expected behavior:
I would expect Ctrl+D to exit the debugger which, on Linux atleast, is consistent with other REPLs/shells such as bash, python, node, and gdb.
At the very least, I would not expect the command line debugger to go into an infinite loop.
Steps to reproduce
godot -d
.Ctrl+C
to drop to debugger prompt.Ctrl+D
.Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: