-
-
Save bertinatto/5769867b5e838a773b38e57d2fd5ce13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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