--- a/docker/run.go Fri Oct 13 12:27:28 2017 -0500
+++ b/docker/run.go Fri Oct 13 17:58:23 2017 -0500
@@ -179,8 +179,12 @@
- // Remove the script on defer OR on signal exit (first one to happen)
- defer st.CleanupList.Add(func() { os.Remove(script.Name()) })()
+ // Be sure to clean up the script on app exit + cleanupFn := st.CleanupList.Add(func() { os.Remove(script.Name()) }) + // Call cleanup function on defer, which will may may instead be called + // if the cleanup thread traps a signal. scriptFile, entryPoint, commandArg, err = r.writeScript(st, script, fullEnv)
--- a/plans/plans.go Fri Oct 13 12:27:28 2017 -0500
+++ b/plans/plans.go Fri Oct 13 17:58:23 2017 -0500
@@ -96,8 +96,12 @@
logger := logging.NewAdapter(path)
planEnv := environment.Merge(env, p.Environment)
- // Teardown plan on defer OR on signal exit (first one to happen)
- defer st.CleanupList.Add(func() { p.teardown(logger, st) })()
+ // Teardown plan on defer on app exit + cleanupFn := st.CleanupList.Add(func() { p.teardown(logger, st) }) + // Call cleanup function on defer, which will may may instead be called + // if the cleanup thread traps a signal. if err := p.setup(logger, st); err != nil {