loadFifos loads the containers fifos
(response *tasks.GetResponse)
| 517 | |
| 518 | // loadFifos loads the containers fifos |
| 519 | func 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 | } |
no test coverage detected
searching dependent graphs…