Disable interactive progress display when no terminal size is available (#3936)

It appears there are cases where our IsInteractive heuristics return true, but terminal.GetSize returns an error. In these cases, we should assume we do not have an interactive terminal and avoid trying to render interactive progress by default.

Fixes #3935.
This commit is contained in:
Luke Hoban 2020-02-19 09:21:03 -08:00 committed by GitHub
parent f6402882c2
commit 4eb2b555fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -20,6 +20,9 @@ CHANGELOG
- Support exporting older stack versions.
[#3906](https://github.com/pulumi/pulumi/pull/3906)
- Disable interactive progress display when no terminal size is available.
[#3936](https://github.com/pulumi/pulumi/pull/3936)
## 1.10.1 (2020-02-06)
- Support stack references in the Go SDK.
[#3829](https://github.com/pulumi/pulumi/pull/3829)

View file

@ -272,10 +272,15 @@ func ShowProgressEvents(op string, action apitype.UpdateKind, stack tokens.QName
}
terminalWidth, terminalHeight, err := terminal.GetSize(int(os.Stdout.Fd()))
contract.IgnoreError(err)
display.isTerminal = opts.IsInteractive
display.terminalWidth = terminalWidth
display.terminalHeight = terminalHeight
if err == nil {
// If the terminal has a size, use it.
display.isTerminal = opts.IsInteractive
display.terminalWidth = terminalWidth
display.terminalHeight = terminalHeight
} else {
// Else assume we are not displaying in a terminal.
display.isTerminal = false
}
go func() {
display.processEvents(ticker, events)