Skip to content

Instantly share code, notes, and snippets.

@bertinatto
Last active December 27, 2017 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bertinatto/5769867b5e838a773b38e57d2fd5ce13 to your computer and use it in GitHub Desktop.
Save bertinatto/5769867b5e838a773b38e57d2fd5ce13 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os"
"os/exec"
"time"
)
const (
self = "/proc/self/exe"
)
func main() {
l, err := os.Readlink(self)
if err != nil {
panic(err)
}
fmt.Printf("Path: %s\n", l)
time.Sleep(time.Duration(1 * time.Second))
fmt.Println("Starting new process")
c := exec.Cmd{
Path: self,
Stdout: os.Stdout,
Stderr: os.Stderr,
}
if err := c.Run(); err != nil {
panic(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment