When using Invoke-Fzf, the working directory of the fzf sub-process isn't changed to match the shell's current directory. When items are relative paths or otherwise depend on the current directory, this causes problems passing them to a preview command.
Using native fzf from a non-home location:
fzf --preview cd
the preview window outputs my current location.
But using Invoke-Fzf:
Invoke-Fzf -Preview cd
the preview window displays my home directory.
My actual use case was piping in a set of git branch names, and trying to preview the selected one with git log --graph {}, only to find that git was erroring on the lack of a .git subdirectory in the fzf process's working directory.
Using PSFzf 1.1.24 on Windows 8.1, PowerShell 6.2.2.
When using
Invoke-Fzf
, the working directory of thefzf
sub-process isn't changed to match the shell's current directory. When items are relative paths or otherwise depend on the current directory, this causes problems passing them to a preview command.Using native
fzf
from a non-home location:the preview window outputs my current location.
But using
Invoke-Fzf
:the preview window displays my home directory.
My actual use case was piping in a set of git branch names, and trying to preview the selected one with
git log --graph {}
, only to find that git was erroring on the lack of a.git
subdirectory in thefzf
process's working directory.Using PSFzf 1.1.24 on Windows 8.1, PowerShell 6.2.2.