Jan 2, 2019

[Go] reexec

The greatest trick the Devil ever pulled was convincing the world he didn't exist. - "Verbal" Kint
https://github.com/moby/moby/tree/v1.12.4/pkg/reexec

func Command(args ...string) *exec.Cmd {
 return &exec.Cmd{
  Path: Self(),
  Args: args,
  SysProcAttr: &syscall.SysProcAttr{
   Pdeathsig: syscall.SIGTERM,
  },
 }
}
Same as in POSIX calls:
if(fork() == 0){
int fd = open("/proc/self/exe", O_RDONLY);
fexecve(fd, argv, envp);
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.