mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
Merge pull request #7400 from Tashows/verify-tty-exec
Check if tty is actually used and support proper output when it's not
This commit is contained in:
@@ -339,7 +339,6 @@ func (k KubernetesClient) ExecCommand(ctx context.Context, input ExecCommandInpu
|
||||
req.Param("stdin", "true")
|
||||
req.Param("stdout", "true")
|
||||
req.Param("stderr", "true")
|
||||
req.Param("tty", "true")
|
||||
|
||||
if input.Entrypoint != "" {
|
||||
req.Param("command", input.Entrypoint)
|
||||
@@ -370,6 +369,20 @@ func (k KubernetesClient) ExecCommand(ctx context.Context, input ExecCommandInpu
|
||||
|
||||
size := t.GetSize()
|
||||
sizeQueue := t.MonitorSize(size)
|
||||
actuallyTty := sizeQueue != nil
|
||||
|
||||
if actuallyTty {
|
||||
req.Param("tty", "true")
|
||||
} else {
|
||||
req.Param("tty", "false")
|
||||
t = term.TTY{
|
||||
In: os.Stdin,
|
||||
Out: stdout,
|
||||
Raw: false,
|
||||
}
|
||||
size = t.GetSize()
|
||||
sizeQueue = t.MonitorSize(size)
|
||||
}
|
||||
|
||||
return t.Safe(func() error {
|
||||
exec, err := remotecommand.NewSPDYExecutor(&k.RestConfig, "POST", req.URL())
|
||||
@@ -381,7 +394,7 @@ func (k KubernetesClient) ExecCommand(ctx context.Context, input ExecCommandInpu
|
||||
Stdin: os.Stdin,
|
||||
Stdout: stdout,
|
||||
Stderr: stderr,
|
||||
Tty: true,
|
||||
Tty: actuallyTty,
|
||||
TerminalSizeQueue: sizeQueue,
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user