reexec: Use in-memory binary on linux instead of os.Args[0]

This keeps reexec working properly even if the on-disk binary was replaced.

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass 2015-07-24 13:51:51 -04:00
parent 0cec613de9
commit 264e16318f
3 changed files with 15 additions and 4 deletions

View file

@ -6,6 +6,12 @@ import (
"os/exec"
)
// Self returns the path to the current process's binary.
// Uses os.Args[0].
func Self() string {
return naiveSelf()
}
// Command returns *exec.Cmd which have Path as current binary.
// For example if current binary is "docker.exe" at "C:\", then cmd.Path will
// be set to "C:\docker.exe".