fix: ide should inherit stdin/out/err
Signed-off-by: jolheiser <john.olheiser@gmail.com>main v0.0.5
parent
42853c9e12
commit
b49dbe94b9
25
cmd/ide.go
25
cmd/ide.go
|
@ -3,10 +3,10 @@ package cmd
|
|||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"os/exec"
|
||||
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
"github.com/peterbourgon/ff/v3/ffcli"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func (h *Handler) IDE() *ffcli.Command {
|
||||
|
@ -38,7 +38,26 @@ func (h *Handler) IDE() *ffcli.Command {
|
|||
}
|
||||
|
||||
path := h.Config.WorkspaceBranch(branch)
|
||||
return exec.Command("hx", path).Start()
|
||||
cmd := exec.Command(getIDE(), path)
|
||||
cmd.Dir = path
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
return cmd.Run()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func getIDE() string {
|
||||
for _, ide := range []string{
|
||||
"hx",
|
||||
"nvim",
|
||||
"goland",
|
||||
"vi",
|
||||
} {
|
||||
if i, err := exec.LookPath(ide); err == nil {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return os.Getenv("EDITOR")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue