cli: Fix CLI blocking forever on terminating backslash
A corner case exists in CLI parsing where if a CLI user in a remote console ends with a backslash and then invokes command completion (using TAB or ?), then the console will freeze forever until a SIGQUIT signal is sent to the process, due to getting blocked forever reading the command completion. CTRL+C and other key combinations have no impact on the CLI session. This occurs because, in such cases, the CLI process is waiting for AST_CLI_COMPLETE_EOF to appear in the buffer from the main process, but instead the main process is confused by the funny syntax and thus prints out the CLI help. As a result, the CLI process is stuck on the read call, waiting for the completion that will never come. This prevents blocking forever by checking if the data from the main process starts with "Usage:". If it does, that means that CLI help was sent instead of the tab complete vector, and thus the CLI should bail out and not wait any longer. ASTERISK-29822 #close Change-Id: I9810ac59304fec162da701653c9c834f0ec8f670
Loading
Please register or sign in to comment