grim/convey

Improve inline docs around cleanup.
inject
2017-10-13, Eric Fritz
fc7d9b732f03
Parents 3ac9cbcdf9d3
Children ee5d8e87bff1
Improve inline docs around cleanup.
--- a/docker/environment.go Fri Oct 13 17:53:15 2017 -0500
+++ b/docker/environment.go Fri Oct 13 17:59:47 2017 -0500
@@ -61,7 +61,12 @@
return err
}
- defer st.CleanupList.Add(func() { os.RemoveAll(tmpDir) })()
+ // Remove temp dir on app exit
+ cleanupFn := st.CleanupList.Add(func() { os.RemoveAll(tmpDir) })
+
+ // Call cleanup function on defer, which will may may instead be called
+ // if the cleanup thread traps a signal.
+ defer cleanupFn()
for _, file := range files {
// Export the file into the temp directory and maintain the