Skip to content

Commit

Permalink
fix: using home directory instead of root directory for forking
Browse files Browse the repository at this point in the history
  • Loading branch information
noble-varghese committed Dec 20, 2024
1 parent 3a3ebc7 commit 7e6e5d2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/scribe/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,15 @@ func startDaemon() {
log.Fatal("Failed to locate scribe executable:", err)
}

homeDir, err := os.UserHomeDir()
if err != nil {
log.Fatal("Failed to get home directory:", err)
}

if os.Getppid() != 1 {
args := append([]string{execPath}, os.Args[1:]...)
proc, err := os.StartProcess(os.Args[0], args, &os.ProcAttr{
Dir: ".",
Dir: homeDir,
Files: []*os.File{os.Stdin, os.Stdout, os.Stderr},
})

Expand Down

0 comments on commit 7e6e5d2

Please # to comment.