mirror of
https://github.com/google/nomulus
synced 2026-07-18 14:02:35 +00:00
542084eb70
Lazy-initialize the terminal and LineReader in ShellCommand to prevent JLine from eagerly probing terminal capabilities during JCommander command-line startup. During CLI startup, JCommander instantiates every command (including ShellCommand) to build the CLI's command map. Eager instantiation of the LineReader inside the ShellCommand constructor causes JLine to query the terminal cursor via Device Status Report (DSR) escape sequences. Standard commands (e.g. list_tlds) do not consume stdin, leaving these probing responses (such as ^[[71;1R and 1;1R) in the buffer to be leaked as garbage characters to standard output. This change defers terminal and LineReader initialization until the shell's run() method is actually executed, while preserving the original constructor for unit tests. BUG=http://b/534855218