Fix mix-up in error message when aborting (#428)

pull/427/head^2
Hugo 3 months ago committed by GitHub
parent 00a4361d20
commit 0edbb6f57a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -3,6 +3,7 @@ package editor
import (
"fmt"
"os"
"os/exec"
"strings"
"github.com/kballard/go-shellquote"
@ -43,5 +44,12 @@ func (e *Editor) Open(paths ...string) error {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return errors.Wrapf(cmd.Run(), "failed to launch editor: %s %s", e.editor, strings.Join(paths, " "))
err := cmd.Run()
switch err.(type) {
case *exec.ExitError:
return errors.Wrapf(err, "operation aborted by editor: %s %s", e.editor, strings.Join(paths, " "))
default:
return errors.Wrapf(err, "failed to launch editor: %s %s", e.editor, strings.Join(paths, " "))
}
}

Loading…
Cancel
Save