Skip to content

Commit 4182605

Browse files
authored
Merge pull request #4 from goto1134/add-pwsh-5-support
Fix Powershell 5 compatibility
2 parents fde4ce3 + b24f609 commit 4182605

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lazy-posh-git.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Copyright = '(c) Christoph Bergmeister. All rights reserved.'
3333
Description = 'Proxy command around Set-Location and its aliases to defer import of posh-git until one is in a git directory.'
3434

3535
# Minimum version of the PowerShell engine required by this module
36-
PowerShellVersion = '7.0'
36+
PowerShellVersion = '5.0'
3737

3838
# Name of the PowerShell host required by this module
3939
# PowerShellHostName = ''

lazy-posh-git.psm1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ function Set-Location {
8686
}
8787
if (Test-Path (Join-Path $PWD.Path '.git')) {
8888
Import-Module posh-git
89-
if (Test-Path $PostImportScriptPath) {
89+
# The first condition helps to prevent ParameterBindingException on PowerShell 5
90+
if ($PostImportScriptPath -and $(Test-Path $PostImportScriptPath)) {
9091
& $PostImportScriptPath
9192
}
9293
}

0 commit comments

Comments
 (0)