Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke-FuzzyEdit - Cmd.exe UNC Handling #104

Open
mattcargile opened this issue Jan 9, 2022 · 1 comment · May be fixed by #201
Open

Invoke-FuzzyEdit - Cmd.exe UNC Handling #104

mattcargile opened this issue Jan 9, 2022 · 1 comment · May be fixed by #201

Comments

@mattcargile
Copy link
Contributor

Description

UNC Path handling for Invoke-FuzzyEdit doesn't work as expected. Additionally, I'd like to optimize the logic a bit within the function?

Reproduce

cd "\\servername\C$\Program Files"
Invoke-FuzzyEdit
## OR 
Invoke-FuzzyEdit '\\servername\C$\Users\'

Expected

I expect to open fzf within the current UNC path at the $PWD or within the -Directory passed in.

Actual

I received the below message and fzf opens in the $HOME directory on a non-elevated session.

'\\servername\c$'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.

Solution

Wrap calls to Cmd.exe in current shell to pushd outside of current directory in case the $PWD is set at a UNC path. Secondly, within the Cmd.exe call, add a "DOS" pushd for the applicable UNC path. Additionally, for the optimizations, I'd like to remove the two cds when -Directory is used and the += array setting.

Environment

Module Version: 2.3.2
Windows Powershell: 5.1.18362.1171
PowerShell Core: 7.2.1
WSL2 Ubuntu: 20.04.3 LTS

@mattcargile
Copy link
Contributor Author

Still working on the commit. I got my branch up to date with master though.

@mattcargile mattcargile changed the title Invoke-FuzzyEdit - Cmd.exe UNC Handling And Optimization Invoke-FuzzyEdit - Cmd.exe UNC Handling Mar 16, 2022
@mattcargile mattcargile linked a pull request Nov 26, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant