diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-13 20:26:02 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-13 20:26:02 +1000 |
commit | 97cff656121270e9c790432e28622d92ab7b0f1a (patch) | |
tree | 7425013e94dc0a19699b48bde6bb20c6f5b86c8a /pkg/commands/os.go | |
parent | f9c39ad64bddd1577636c0ce5606eda44bc704ef (diff) |
progress on refactor
Diffstat (limited to 'pkg/commands/os.go')
-rw-r--r-- | pkg/commands/os.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pkg/commands/os.go b/pkg/commands/os.go index e7fe4515f..2313b5550 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -15,6 +15,8 @@ import ( var ( // ErrNoOpenCommand : When we don't know which command to use to open a file ErrNoOpenCommand = errors.New("Unsure what command to use to open this file") + // ErrNoEditorDefined : When we can't find an editor to edit a file + ErrNoEditorDefined = errors.New("No editor defined in $VISUAL, $EDITOR, or git config") ) // Platform stores the os state @@ -138,14 +140,14 @@ func (c *OSCommand) editFile(g *gocui.Gui, filename string) (string, error) { } } if editor == "" { - return "", createErrorPanel(g, "No editor defined in $VISUAL, $EDITOR, or git config.") + return "", ErrNoEditorDefined } - c.RunSubProcess(editor, filename) + c.PrepareSubProcess(editor, filename) return "", nil } -// RunSubProcess iniRunSubProcessrocess then tells the Gui to switch to it -func (c *OSCommand) RunSubProcess(cmdName string, commandArgs ...string) (*exec.Cmd, error) { +// PrepareSubProcess iniPrepareSubProcessrocess then tells the Gui to switch to it +func (c *OSCommand) PrepareSubProcess(cmdName string, commandArgs ...string) (*exec.Cmd, error) { subprocess := exec.Command(cmdName, commandArgs...) subprocess.Stdin = os.Stdin subprocess.Stdout = os.Stdout |