tbot
tbot copied to clipboard
linux.util: Fix wait_for_shell hang
This change modifies tbot's wait_for_shell() to evaluate simple math instead of the existing echo TBOT''LOGIN. If a portion of the previously used echo command is dropped (including one single quote character but not both), then the shell interprets the command to be a multiline command. All subsequent retries of the echo command are then interpreted as part of the command, instead of new commands, and this loop essentially continues forever.
Using expr 41 + 1 and expecting 42 achieves the same objective of determining if the shell is ready but is protected against dropped characters resulting in an infinite loop.