11package oci
22
33import (
4+ "bytes"
45 "fmt"
56 "io"
67 "os"
@@ -10,10 +11,8 @@ import (
1011 "syscall"
1112 "time"
1213
13- "github.com/cri-o/cri-o/internal/dirnotifier"
1414 "github.com/cri-o/cri-o/pkg/config"
1515 "github.com/cri-o/cri-o/server/cri/types"
16- "github.com/fsnotify/fsnotify"
1716 rspec "github.com/opencontainers/runtime-spec/specs-go"
1817 "github.com/pkg/errors"
1918 "golang.org/x/net/context"
@@ -44,7 +43,6 @@ type Runtime struct {
4443 config * config.Config
4544 runtimeImplMap map [string ]RuntimeImpl
4645 runtimeImplMapMutex sync.RWMutex
47- execNotifier * dirnotifier.DirectoryNotifier
4846}
4947
5048// RuntimeImpl is an interface used by the caller to interact with the
@@ -83,14 +81,9 @@ func New(c *config.Config) (*Runtime, error) {
8381 return nil , errors .Wrapf (err , "create oci runtime pid dir" )
8482 }
8583
86- notifier , err := dirnotifier .New (execNotifyDir , fsnotify .Write , fsnotify .Rename )
87- if err != nil {
88- return nil , err
89- }
9084 return & Runtime {
9185 config : c ,
9286 runtimeImplMap : make (map [string ]RuntimeImpl ),
93- execNotifier : notifier ,
9487 }, nil
9588}
9689
@@ -433,6 +426,18 @@ func (r *Runtime) ReopenContainerLog(ctx context.Context, c *Container) error {
433426 return impl .ReopenContainerLog (ctx , c )
434427}
435428
429+ // ExecSyncError wraps command's streams, exit code and error on ExecSync error.
430+ type ExecSyncError struct {
431+ Stdout bytes.Buffer
432+ Stderr bytes.Buffer
433+ ExitCode int32
434+ Err error
435+ }
436+
437+ func (e * ExecSyncError ) Error () string {
438+ return fmt .Sprintf ("command error: %+v, stdout: %s, stderr: %s, exit code %d" , e .Err , e .Stdout .Bytes (), e .Stderr .Bytes (), e .ExitCode )
439+ }
440+
436441// BuildContainerdBinaryName() is responsible for ensuring the binary passed will
437442// be properly converted to the containerd binary naming pattern.
438443//
0 commit comments