mirror of
https://github.com/docker/compose.git
synced 2025-07-21 20:54:32 +02:00
detect terminal is not a console.File
to avoid a panic
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
dc01b98aa6
commit
18a112e88c
2
go.mod
2
go.mod
@ -58,7 +58,7 @@ require (
|
|||||||
github.com/bugsnag/bugsnag-go v1.5.0 // indirect
|
github.com/bugsnag/bugsnag-go v1.5.0 // indirect
|
||||||
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
|
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||||
github.com/cloudflare/cfssl v1.4.1 // indirect
|
github.com/cloudflare/cfssl v1.4.1
|
||||||
github.com/containerd/continuity v0.3.0 // indirect
|
github.com/containerd/continuity v0.3.0 // indirect
|
||||||
github.com/containerd/ttrpc v1.1.1 // indirect
|
github.com/containerd/ttrpc v1.1.1 // indirect
|
||||||
github.com/containerd/typeurl v1.0.2 // indirect
|
github.com/containerd/typeurl v1.0.2 // indirect
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/cloudflare/cfssl/log"
|
||||||
"github.com/docker/compose/v2/pkg/api"
|
"github.com/docker/compose/v2/pkg/api"
|
||||||
|
|
||||||
"github.com/containerd/console"
|
"github.com/containerd/console"
|
||||||
@ -118,11 +119,16 @@ func NewWriter(ctx context.Context, out io.Writer, progressTitle string) (Writer
|
|||||||
if !ok {
|
if !ok {
|
||||||
dryRun = false
|
dryRun = false
|
||||||
}
|
}
|
||||||
if Mode == ModeAuto && isTerminal {
|
f, isConsole := out.(console.File) // see https://github.com/docker/compose/issues/10560
|
||||||
return newTTYWriter(out.(console.File), dryRun, progressTitle)
|
if Mode == ModeAuto && isTerminal && isConsole {
|
||||||
|
return newTTYWriter(f, dryRun, progressTitle)
|
||||||
}
|
}
|
||||||
if Mode == ModeTTY {
|
if Mode == ModeTTY {
|
||||||
return newTTYWriter(out.(console.File), dryRun, progressTitle)
|
if !isConsole {
|
||||||
|
log.Warning("Terminal is not a POSIX console")
|
||||||
|
} else {
|
||||||
|
return newTTYWriter(f, dryRun, progressTitle)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return &plainWriter{
|
return &plainWriter{
|
||||||
out: out,
|
out: out,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user