mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-25 02:54:03 -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
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
var args []string
|
editor = strings.TrimSpace(editor)
|
||||||
if strings.Contains(editor, " ") {
|
args := strings.Split(editor, " ")
|
||||||
strs := strings.Split(editor, " ")
|
|
||||||
editor = strs[0]
|
editor = args[0]
|
||||||
args = strs[1:]
|
args = append(args[1:], file)
|
||||||
}
|
|
||||||
|
|
||||||
args = append(args, file)
|
|
||||||
cmd := exec.Command(editor, args...)
|
cmd := exec.Command(editor, args...)
|
||||||
|
|
||||||
err := cmd.Run()
|
cmd.Stdin = os.Stdin
|
||||||
if err != nil {
|
cmd.Stdout = os.Stdout
|
||||||
|
cmd.Stderr = os.Stderr
|
||||||
|
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
fmt.Println(err.Error())
|
fmt.Println(err.Error())
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmd.ProcessState.ExitCode()
|
return 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue