MCPcopy
hub / github.com/containerd/containerd / loadFifos

Function loadFifos

client/container.go:519–553  ·  view source on GitHub ↗

loadFifos loads the containers fifos

(response *tasks.GetResponse)

Source from the content-addressed store, hash-verified

517
518// loadFifos loads the containers fifos
519func loadFifos(response *tasks.GetResponse) *cio.FIFOSet {
520 fifos := []string{
521 response.Process.Stdin,
522 response.Process.Stdout,
523 response.Process.Stderr,
524 }
525 closer := func() error {
526 var (
527 err error
528 dirs = map[string]struct{}{}
529 )
530 for _, f := range fifos {
531 if isFifo, _ := fifo.IsFifo(f); isFifo {
532 if rerr := os.Remove(f); err == nil {
533 err = rerr
534 }
535 dirs[filepath.Dir(f)] = struct{}{}
536 }
537 }
538 for dir := range dirs {
539 // we ignore errors here because we don't
540 // want to remove the directory if it isn't
541 // empty
542 _ = os.Remove(dir)
543 }
544 return err
545 }
546
547 return cio.NewFIFOSet(cio.Config{
548 Stdin: response.Process.Stdin,
549 Stdout: response.Process.Stdout,
550 Stderr: response.Process.Stderr,
551 Terminal: response.Process.Terminal,
552 }, closer)
553}

Callers 1

attachExistingIOFunction · 0.85

Calls 3

NewFIFOSetFunction · 0.92
DirMethod · 0.80
RemoveMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…