File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77)
88
99func Delete () error {
10- processDir , found := nearestProcessDirectory (os . Getppid ())
10+ processDir , found := nearestProcessDirectory (parentId ())
1111 if ! found || len (processDir ) == 0 {
1212 return singletonsI18n .SessionNotFound ()
1313 }
Original file line number Diff line number Diff line change @@ -4,30 +4,38 @@ import (
44 "fmt"
55 "os"
66 "path"
7+ "strconv"
78
89 "github.com/mitchellh/go-ps"
910)
1011
11- func parentId (pid int ) (int , error ) {
12- process , err := ps .FindProcess (pid )
12+ func parentId () int {
13+ var ppid int
14+
15+ envppid := os .Getenv ("TAU_PPID" )
16+ if envppid != "" {
17+ ppid , _ = strconv .Atoi (envppid )
18+ } else {
19+ ppid = os .Getppid ()
20+ }
21+
22+ process , err := ps .FindProcess (ppid )
1323 if err != nil {
14- return 0 , err
24+ return ppid
1525 }
1626
1727 // This is for `go run .`
18- if process .Executable () == "go" {
19- return process .PPid (), nil
28+ if process .Executable () == "go" || process . Executable () == "node" {
29+ return process .PPid ()
2030 }
2131
22- return process .Pid (), nil
32+ return process .Pid ()
2333}
2434
2535func discoverOrCreateConfigFileLoc () (string , error ) {
26- grandPid , err := parentId (os .Getppid ())
27- if err != nil {
28- return "" , err
29- }
36+ grandPid := parentId ()
3037
38+ var err error
3139 processDir , found := nearestProcessDirectory (grandPid )
3240 if ! found {
3341 processDir , err = createProcessDirectory (grandPid )
You can’t perform that action at this time.
0 commit comments