Skip to content

assert minimum powershell version#1385

Merged
zimbatm merged 3 commits intodirenv:masterfrom
simonLeary42:patch-1
Mar 25, 2025
Merged

assert minimum powershell version#1385
zimbatm merged 3 commits intodirenv:masterfrom
simonLeary42:patch-1

Conversation

@simonLeary42
Copy link
Copy Markdown
Contributor

@simonLeary42 simonLeary42 commented Feb 16, 2025

when running direnv on an older version of powershell, every new shell produces this error:

Unable to find type [LocationChangedEventArgs].
At line:1 char:81
+ ... .Automation;  $hook = [EventHandler[LocationChangedEventArgs]] {   pa ...
+                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (LocationChangedEventArgs:TypeName) [], RuntimeExcep
   tion
    + FullyQualifiedErrorId : TypeNotFound

The property 'LocationChangedAction' cannot be found on this object. Verify that the property exists
and can be set.
At line:1 char:647
+ ...  } else {   $ExecutionContext.SessionState.InvokeCommand.LocationChan ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

this would be nicer:

PS /Users/simon> Invoke-Expression "$(/tmp/direnv-install/bin/direnv hook pwsh)"
Exception: direnv: powershell version 7.5.0 does not meet the minimum required version 8!

note that the minimum version is 7, the above output was made on my machine with a bogus minimum greater than what I had installed

@simonLeary42
Copy link
Copy Markdown
Contributor Author

@zimbatm zimbatm merged commit 1dc9bb7 into direnv:master Mar 25, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants