Skip to content

Commit 5508046

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]> (cherry picked from commit fbb80b9) Signed-off-by: Wei Fu <[email protected]>
1 parent 5a62161 commit 5508046

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
@@ -104,6 +104,10 @@ func main() {
104104
stderr.Close()
105105
}()
106106

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

0 commit comments

Comments
 (0)