mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-11-25 14:07:35 +00:00
Fix init error in PowerShell strict mode (#233)
This commit is contained in:
parent
b9b0abe471
commit
20d9f3d18c
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Fixed
|
||||
|
||||
- Nushell: errors on 0.33.0.
|
||||
- PowerShell: errors when initializing in `StrictMode`.
|
||||
|
||||
## [0.7.2] - 2021-06-10
|
||||
|
||||
|
@ -280,7 +280,8 @@ mod tests {
|
||||
#[values(false, true)] resolve_symlinks: bool,
|
||||
) {
|
||||
let opts = Opts { cmd, hook, echo, resolve_symlinks };
|
||||
let source = Powershell(&opts).render().unwrap();
|
||||
let mut source = "Set-StrictMode -Version latest\n".to_string();
|
||||
Powershell(&opts).render_into(&mut source).unwrap();
|
||||
|
||||
Command::new("pwsh")
|
||||
.args(&["-NoLogo", "-NonInteractive", "-NoProfile", "-Command", &source])
|
||||
|
@ -34,8 +34,11 @@ function __zoxide_hook {
|
||||
}
|
||||
|
||||
# Initialize hook.
|
||||
if ($__zoxide_hooked -ne '1') {
|
||||
$__zoxide_hooked = '1'
|
||||
{# Initialize $__zoxide_hooked if it does not exist. Removing this will cause
|
||||
# an unset variable error in StrictMode. #}
|
||||
$__zoxide_hooked = (Get-Variable __zoxide_hooked -ValueOnly -ErrorAction silentlycontinue)
|
||||
if ($__zoxide_hooked -ne 1) {
|
||||
$__zoxide_hooked = 1
|
||||
{%- match hook %}
|
||||
{%- when InitHook::None %}
|
||||
{{ not_configured }}
|
||||
|
Loading…
Reference in New Issue
Block a user