Skip to content

Commit

Permalink
fix(pwsh): stop paths from being interpreted as patterns (starship#1569)
Browse files Browse the repository at this point in the history
Convert-Path in the powershell prompt script works with -Path,
which interprets paths as wildcard patterns.  

Not all valid paths are also valid wildcard patterns, possibly causing
the prompt to error (eg []*).  

Replace it with -LiteralPath that makes Convert-Path use the path as-is.
  • Loading branch information
davidkna authored Aug 20, 2020
1 parent 09672ee commit d451569
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/init/starship.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function global:prompt {
$jobs = @(Get-Job | Where-Object { $_.State -eq 'Running' }).Count

$env:PWD = $PWD
$current_directory = (Convert-Path $PWD)
$current_directory = (Convert-Path -LiteralPath $PWD)

if ($lastCmd = Get-History -Count 1) {
$duration = [math]::Round(($lastCmd.EndExecutionTime - $lastCmd.StartExecutionTime).TotalMilliseconds)
Expand Down

0 comments on commit d451569

Please sign in to comment.