Skip to content

Commit f246fb2

Browse files
tonymetjunegunn
authored andcommitted
Show error message when failed to start preview command (junegunn#1810)
Fix junegunn#1637
1 parent f7b26b3 commit f246fb2

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ doc/tags
88
vendor
99
gopath
1010
*.zwc
11+
fzf

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,8 @@ See *KEY BINDINGS* section of the man page for details.
480480
### Preview window
481481

482482
When `--preview` option is set, fzf automatically starts an external process with
483-
the current line as the argument and shows the result in the split window.
483+
the current line as the argument and shows the result in the split window. Your
484+
`$SHELL` is used to execute the command with `$SHELL -c COMMAND`
484485

485486
```bash
486487
# {} is replaced to the single-quoted string of the focused line

src/terminal.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,10 @@ func (t *Terminal) Loop() {
15761576
var out bytes.Buffer
15771577
cmd.Stdout = &out
15781578
cmd.Stderr = &out
1579-
cmd.Start()
1579+
err := cmd.Start()
1580+
if err != nil {
1581+
out.Write([]byte(err.Error()))
1582+
}
15801583
finishChan := make(chan bool, 1)
15811584
updateChan := make(chan bool)
15821585
go func() {

0 commit comments

Comments
 (0)