Skip to content
This repository was archived by the owner on Jan 2, 2026. It is now read-only.

Commit c1fe54d

Browse files
committed
Use command -v instead of which
1 parent 6aa1e0b commit c1fe54d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cli/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ func execCommand(cmd *cobra.Command, args []string) error {
278278
editor = env("EDITOR")
279279
if editor == "" {
280280
logrus.Debug("$EDITOR not set, trying $(which vim)...")
281-
editor = "$(which vim)"
281+
editor = "$(command -v vim)"
282282
}
283283
}
284284
cmdline := []string{"sh", "-c", strings.Join([]string{editor, src}, " ")}

cli/cli_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func TestExecCommand(t *testing.T) {
223223
syscallExec = func(argv0 string, argv []string, envv []string) error {
224224
called = true
225225
assert.Equal(t, "/bin/sh", argv0)
226-
assert.Equal(t, []string{"sh", "-c", "$(which vim) /path/to/foo"}, argv)
226+
assert.Equal(t, []string{"sh", "-c", "$(command -v vim) /path/to/foo"}, argv)
227227
return nil
228228
}
229229

0 commit comments

Comments
 (0)