mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-24 10:34:04 -08:00
fix(cli): open EDITOR correctly
Some checks failed
Code QL / code-ql (push) Has been cancelled
Release / changelog (push) Has been cancelled
Release / artifacts (push) Has been cancelled
Release / msi (arm64) (push) Has been cancelled
Release / msi (x64) (push) Has been cancelled
Release / msi (x86) (push) Has been cancelled
Release / release (push) Has been cancelled
Some checks failed
Code QL / code-ql (push) Has been cancelled
Release / changelog (push) Has been cancelled
Release / artifacts (push) Has been cancelled
Release / msi (arm64) (push) Has been cancelled
Release / msi (x64) (push) Has been cancelled
Release / msi (x86) (push) Has been cancelled
Release / release (push) Has been cancelled
resolves #6019
This commit is contained in:
parent
b4d0b42395
commit
bba8c040c2
|
@ -14,21 +14,22 @@ func editFileWithEditor(file string) int {
|
|||
return 1
|
||||
}
|
||||
|
||||
var args []string
|
||||
if strings.Contains(editor, " ") {
|
||||
strs := strings.Split(editor, " ")
|
||||
editor = strs[0]
|
||||
args = strs[1:]
|
||||
}
|
||||
editor = strings.TrimSpace(editor)
|
||||
args := strings.Split(editor, " ")
|
||||
|
||||
editor = args[0]
|
||||
args = append(args[1:], file)
|
||||
|
||||
args = append(args, file)
|
||||
cmd := exec.Command(editor, args...)
|
||||
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
fmt.Println(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
return cmd.ProcessState.ExitCode()
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue