func runShell(version string) { if os.Getenv("GOBU") != "" { log.Fatalln("Already in boostraped env!") } os.Setenv("GOBU", "1") log.Println(">> You are now in a new GOBU shell. To exit, type 'exit'") shell := os.Getenv("SHELL") if runtime.GOOS == "windows" { parentID := os.Getppid() parentProcess, err := ps.FindProcess(parentID) if err != nil { log.Fatalln(err) } shell = parentProcess.Executable() } shellBinary := resolveBinary(shell) run(version, shellBinary, []string{shellBinary}) log.Println("Exited gobu shell") }
func NewProcess(pid int) (p Process, err error) { mp, err := mps.FindProcess(pid) if err != nil { return } return Process{ Process: mp, }, nil }