Skip to content

Commit fbb80b9

Browse files
committed
containerd-shim: redirect output into stdout fifo
Redirect is used to make sure that containerd still can read the log of shim after restart. Signed-off-by: Wei Fu <[email protected]>
1 parent bc94455 commit fbb80b9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

cmd/containerd-shim/main_unix.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ func main() {
110110
stderr.Close()
111111
}()
112112

113+
// redirect the following output into fifo to make sure that containerd
114+
// still can read the log after restart
115+
logrus.SetOutput(stdout)
116+
113117
if err := executeShim(); err != nil {
114118
fmt.Fprintf(os.Stderr, "containerd-shim: %s\n", err)
115119
os.Exit(1)
@@ -119,7 +123,7 @@ func main() {
119123
// If containerd server process dies, we need the shim to keep stdout/err reader
120124
// FDs so that Linux does not SIGPIPE the shim process if it tries to use its end of
121125
// these pipes.
122-
func openStdioKeepAlivePipes(dir string) (io.ReadCloser, io.ReadCloser, error) {
126+
func openStdioKeepAlivePipes(dir string) (io.ReadWriteCloser, io.ReadWriteCloser, error) {
123127
background := context.Background()
124128
keepStdoutAlive, err := shimlog.OpenShimStdoutLog(background, dir)
125129
if err != nil {

0 commit comments

Comments
 (0)