From 5a688c3e2862be320ad69b1363af3889609b3a35 Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Mon, 2 May 2016 13:59:40 -0700 Subject: [PATCH] Cleanup stdio files upon start and exec termination (ctr). Signed-off-by: Kenfe-Mickael Laventure --- ctr/container.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ctr/container.go b/ctr/container.go index 434baba..a95ceea 100644 --- a/ctr/container.go +++ b/ctr/container.go @@ -164,6 +164,11 @@ var startCommand = cli.Command{ fatal(fmt.Sprintf("cannot get the absolute path of the bundle: %v", err), 1) } s, err := createStdio() + defer func() { + if s.stdin != "" { + os.RemoveAll(filepath.Dir(s.stdin)) + } + }() if err != nil { fatal(err.Error(), 1) } @@ -463,6 +468,11 @@ var execCommand = cli.Command{ }, } s, err := createStdio() + defer func() { + if s.stdin != "" { + os.RemoveAll(filepath.Dir(s.stdin)) + } + }() if err != nil { fatal(err.Error(), 1) }