Skip to content

Commit

Permalink
Add support for ZK_SHELL (zk-org#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-menu authored Feb 4, 2022
1 parent c6e529f commit e037bef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
* [#144](https://github.com/mickael-menu/zk/issues/144) LSP auto-completion of YAML frontmatter tags.
* [zk-nvim#26](https://github.com/mickael-menu/zk-nvim/issues/26) The LSP server doesn't use `additionalTextEdits` anymore to remove the trigger characters when completing links.
* You can customize the default behavior with the [`use-additional-text-edits` configuration key](docs/config-lsp.md).
* [#163](https://github.com/mickael-menu/zk/issues/163) Use the `ZK_SHELL` environment variable to override the shell for `zk` only.

### Fixed

Expand Down
12 changes: 7 additions & 5 deletions internal/util/exec/exec_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
package exec

import (
"os"
"os/exec"

osutil "github.com/mickael-menu/zk/internal/util/os"
)

// CommandFromString returns a Cmd running the given command with $SHELL.
func CommandFromString(command string, args ...string) *exec.Cmd {
shell := os.Getenv("SHELL")
if len(shell) == 0 {
shell = "sh"
}
shell := osutil.GetOptEnv("ZK_SHELL").
Or(osutil.GetOptEnv("SHELL")).
OrString("sh").
Unwrap()

args = append([]string{"-c", command, "--"}, args...)
return exec.Command(shell, args...)
}

0 comments on commit e037bef

Please sign in to comment.