lookup vi from $PATH

master
Bel LaPointe 2021-12-31 21:49:47 -05:00
parent ad8e5d7a44
commit 03f77ae2a9
1 changed files with 5 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import (
"io/ioutil"
"local/pt-todo-server/pttodo"
"os"
"os/exec"
"path"
"syscall"
@ -52,7 +53,10 @@ func edit(filepath string) error {
return nil
}
vi := func() error {
vibin := "/usr/bin/vi"
vibin, err := exec.LookPath("vi")
if err != nil {
return err
}
cpid, err := syscall.ForkExec(
vibin,
[]string{vibin, tempFile},