1
0
mirror of https://github.com/cheat/cheat.git synced 2025-05-30 03:47:05 +02:00

Merge pull request from chrisallenlane/issue-301

fix: issue 
This commit is contained in:
Chris Allen Lane 2020-02-02 15:54:47 -05:00 committed by GitHub
commit f7183aa17a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -99,8 +99,15 @@ func cmdEdit(opts map[string]interface{}, conf config.Config) {
}
}
// split `conf.Editor` into parts to separate the editor's executable from
// any arguments it may have been passed. If this is not done, the nearby
// call to `exec.Command` will fail.
parts := strings.Fields(conf.Editor)
editor := parts[0]
args := append(parts[1:], editpath)
// edit the cheatsheet
cmd := exec.Command(conf.Editor, editpath)
cmd := exec.Command(editor, args...)
cmd.Stdout = os.Stdout
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr