mirror of
https://github.com/mickael-menu/zk
synced 2024-11-15 12:12:56 +00:00
Fix mix-up in error message when aborting (#428)
This commit is contained in:
parent
00a4361d20
commit
0edbb6f57a
@ -3,6 +3,7 @@ package editor
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/kballard/go-shellquote"
|
"github.com/kballard/go-shellquote"
|
||||||
@ -43,5 +44,12 @@ func (e *Editor) Open(paths ...string) error {
|
|||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
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…
Reference in New Issue
Block a user