Ensure that "command not found" error is printed on stderr

Otherwise, for example, a `browse` command would have failed silently if
the program for the browser couldn't be found.

Ref. f507de0596

Fixes #1289
This commit is contained in:
Mislav Marohnić 2016-10-03 19:09:41 +02:00
Родитель b78bc1d1e1
Коммит 854d86ccbe
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -77,7 +77,10 @@ func (cmd *Cmd) Exec() error {
binary, err := exec.LookPath(cmd.Name)
if err != nil {
return fmt.Errorf("command not found: %s", cmd.Name)
return &exec.Error{
Name: cmd.Name,
Err: fmt.Errorf("command not found"),
}
}
args := []string{binary}