diff --git a/kak/connect.go b/kak/connect.go index 3184eb2..68c3df9 100644 --- a/kak/connect.go +++ b/kak/connect.go @@ -3,17 +3,16 @@ package kak import ( "fmt" "os" - "os/exec" "syscall" ) func Connect(kctx *Context, fp *Filepath) error { - kakBinary, err := exec.LookPath("kak") + kakExec, err := kakExec() if err != nil { return err } - kakExecArgs := []string{kakBinary} + kakExecArgs := []string{kakExec} kakExecArgs = append(kakExecArgs, "-c", kctx.Session.Name) if fp.Name != "" { @@ -27,9 +26,10 @@ func Connect(kctx *Context, fp *Filepath) error { fmt.Println(kakExecArgs) - execErr := syscall.Exec(kakBinary, kakExecArgs, os.Environ()) + execErr := syscall.Exec(kakExec, kakExecArgs, os.Environ()) if execErr != nil { return execErr } + return nil } diff --git a/kak/run.go b/kak/run.go index 48aed23..0490dc5 100644 --- a/kak/run.go +++ b/kak/run.go @@ -3,17 +3,16 @@ package kak import ( "fmt" "os" - "os/exec" "syscall" ) func Run(fp *Filepath) error { - kakBinary, err := exec.LookPath("kak") + kakExec, err := kakExec() if err != nil { return err } - kakExecArgs := []string{kakBinary} + kakExecArgs := []string{kakExec} if fp.Name != "" { kakExecArgs = append(kakExecArgs, fp.Name) @@ -25,9 +24,10 @@ func Run(fp *Filepath) error { fmt.Println(kakExecArgs) - execErr := syscall.Exec(kakBinary, kakExecArgs, os.Environ()) + execErr := syscall.Exec(kakExec, kakExecArgs, os.Environ()) if execErr != nil { return execErr } + return nil }