Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(GH-1781) fix: use ProviderPath for Get-Location
When seeing the following error: `ERROR: Exception calling "Start" with "0" argument(s): "The directory name is invalid"` this can stem off of permissions issues or an incorrectly formatted directory being passed. When using Get-Location, if that location is a UNC path, PowerShell shows that with `Microsoft.PowerShell.Core\FileSystem::\\server\share`, resulting in that entire string to be passed as the PATH for the working directory that is passed to `System.Diagnostics.Process.StartInfo.WorkingDirectory`. Unfortunately that doesn't evaluate to an acutal valid path, thus the error is produced. Instead, the path should be evaluated with ProviderPath, which removes the `Microsoft.PowerShell.Core\FileSystem::` from the actual path, resulting in a valid path using a UNC location. Also make a determination if the path is not set (such as with things that are run during provisioning) and provide a valid working directory using cache location.
- Loading branch information
9e2e49a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow on commit at 02ea65e