Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return an error when the terminal reports zero columns and is refreshed
When used within a call to `docker exec -it` where the original container does not have a TTY allocated to it (such as in moby/moby#8755), the number of columns read from the `ioctl()` call will be zero, but it will not return an error. If you call `Prompt()` or `PasswordPrompt()` after this, the prompt will panic when it tries to divide a number by the number of columns (which is zero). This change detects when the number of columns returned is zero and returns `ErrNoColumns` from the `PromptXXX` methods to avoid a panic and so the application is able to deal with the problem more easily.
- Loading branch information