I have AppV1.1, and i want to replace AppV1.1 with AppV1.2.
I want to kill the parent and have the child take it’s place.
When i use:
c := exec.Command(filePath, "")
c.Stdout = os.Stdout
c.Stderr = os.Stderr
if err := c.Run(); err != nil {
return fmt.Errorf("could not update linux service to use the latest executable %s: %v", filePath, err)
}
I have tried:
c.Run()
c.Start();
c.Start(); c.Wait(); //I think this is c.Run()
syscall.ForkExec(filePath, s, execSpec)
They all end at the same spot.
This will work but it doesn’t kill the parent. It doesn’t matter how i kill the parent, but if i kill the parent, the child becomes corrupted.
I can use os.Exit(0)
in the program, or just kill -9 pid
, it doesn’t matter, the child is corrupted.
I am using "github.com/carlescere/scheduler"
to schedule tasks.
I believe the threads are failing to fork properly.
Thank you for help.