console.ClearONLCR: move it back

This reverts most of commit 24c05b7, as otherwise it causes
a few regressions (docker cli, TestDockerSwarmSuite/TestServiceLogsTTY).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2021-01-17 20:07:07 -08:00
parent 49cc2a22c3
commit dac0c1e34a
4 changed files with 12 additions and 4 deletions
+3
View File
@@ -106,6 +106,9 @@ func handleSingle(path string, noStdin bool) error {
if err != nil {
return err
}
if err := console.ClearONLCR(c.Fd()); err != nil {
return err
}
// Copy from our stdio to the master fd.
var (
-4
View File
@@ -186,10 +186,6 @@ func setupConsole(socket *os.File, config *initConfig, mount bool) error {
if err != nil {
return err
}
err = console.ClearONLCR(pty.Fd())
if err != nil {
return err
}
// After we return from here, we don't need the console anymore.
defer pty.Close()
+5
View File
@@ -313,6 +313,11 @@ func TestExecInTTY(t *testing.T) {
done <- fmt.Errorf("ConsoleFromFile: %w", err)
return
}
err = console.ClearONLCR(c.Fd())
if err != nil {
done <- fmt.Errorf("ClearONLCR: %w", err)
return
}
// An error from io.Copy is expected once the terminal
// is gone, so we deliberately ignore it.
_, _ = io.Copy(&stdout, c)
+4
View File
@@ -112,6 +112,10 @@ func (t *tty) recvtty(process *libcontainer.Process, socket *os.File) (Err error
if err != nil {
return err
}
err = console.ClearONLCR(cons.Fd())
if err != nil {
return err
}
epoller, err := console.NewEpoller()
if err != nil {
return err