diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-09-14 11:04:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-14 11:04:15 -0400 |
commit | 5e54f72a9fd119168a29c0133cac2ed36d2014b5 (patch) | |
tree | eb992bd5ac686abac4fc442c8b5640e72c1a8532 | |
parent | cc9491447479844ffdd27ba1c310d7e0a5a59a79 (diff) | |
parent | 31604b43d13c93bc730b07227ed0c39a7b3314cd (diff) | |
download | podman-5e54f72a9fd119168a29c0133cac2ed36d2014b5.tar.gz podman-5e54f72a9fd119168a29c0133cac2ed36d2014b5.tar.bz2 podman-5e54f72a9fd119168a29c0133cac2ed36d2014b5.zip |
Merge pull request #11562 from Luap99/revert-log
[v3.4] Revert "logs: adjust handling around partial log messages"
-rw-r--r-- | libpod/logs/log.go | 12 | ||||
-rw-r--r-- | libpod/oci_conmon_linux.go | 8 | ||||
-rw-r--r-- | pkg/api/handlers/compat/containers_logs.go | 4 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/containers.go | 4 |
4 files changed, 10 insertions, 18 deletions
diff --git a/libpod/logs/log.go b/libpod/logs/log.go index a584de0ee..1a0223edc 100644 --- a/libpod/logs/log.go +++ b/libpod/logs/log.go @@ -251,19 +251,11 @@ func (l *LogLine) Write(stdout io.Writer, stderr io.Writer, logOpts *LogOptions) switch l.Device { case "stdout": if stdout != nil { - if l.Partial() { - fmt.Fprint(stdout, l.String(logOpts)) - } else { - fmt.Fprintln(stdout, l.String(logOpts)) - } + fmt.Fprintln(stdout, l.String(logOpts)) } case "stderr": if stderr != nil { - if l.Partial() { - fmt.Fprint(stderr, l.String(logOpts)) - } else { - fmt.Fprintln(stderr, l.String(logOpts)) - } + fmt.Fprintln(stderr, l.String(logOpts)) } default: // Warn the user if the device type does not match. Most likely the file is corrupted. diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go index c00d83f95..924df2310 100644 --- a/libpod/oci_conmon_linux.go +++ b/libpod/oci_conmon_linux.go @@ -624,11 +624,9 @@ func (r *ConmonOCIRuntime) HTTPAttach(ctr *Container, req *http.Request, w http. if err != nil { break } - if !logLine.Partial() { - _, err = httpBuf.Write([]byte("\n")) - if err != nil { - break - } + _, err = httpBuf.Write([]byte("\n")) + if err != nil { + break } err = httpBuf.Flush() if err != nil { diff --git a/pkg/api/handlers/compat/containers_logs.go b/pkg/api/handlers/compat/containers_logs.go index 4adcaa511..d73b02b47 100644 --- a/pkg/api/handlers/compat/containers_logs.go +++ b/pkg/api/handlers/compat/containers_logs.go @@ -153,7 +153,9 @@ func LogsFromContainer(w http.ResponseWriter, r *http.Request) { } frame.WriteString(line.Msg) - if !line.Partial() { + // Log lines in the compat layer require adding EOL + // https://github.com/containers/podman/issues/8058 + if !utils.IsLibpodRequest(r) { frame.WriteString("\n") } diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index 81ddce42f..b638bfe24 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -404,11 +404,11 @@ func (ic *ContainerEngine) ContainerLogs(_ context.Context, nameOrIDs []string, return err case line := <-stdoutCh: if opts.StdoutWriter != nil { - _, _ = io.WriteString(opts.StdoutWriter, line) + _, _ = io.WriteString(opts.StdoutWriter, line+"\n") } case line := <-stderrCh: if opts.StderrWriter != nil { - _, _ = io.WriteString(opts.StderrWriter, line) + _, _ = io.WriteString(opts.StderrWriter, line+"\n") } } } |