From 5226b57eeb99697e638b0831079f66975981d11e Mon Sep 17 00:00:00 2001 From: Gadzhi Kharkharov Date: Wed, 15 Sep 2021 17:59:29 +0300 Subject: [PATCH] get kak executable in commands --- kak/connect.go | 8 ++++---- kak/run.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) 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 }