execute './.ww4/runExit` on exeit of container exec

This commit is contained in:
Christian Goll
2022-01-31 17:20:24 +01:00
parent 255d8c9252
commit ad87ba7647

View File

@@ -85,6 +85,16 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
_, err = os.Stat("./.ww4/runExit")
if os.IsNotExist(err) {
wwlog.Printf(wwlog.DEBUG, "no exit script")
return nil
}
err = syscall.Exec("./.ww4/runExit", []string{""}, os.Environ())
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
return nil
}