Commit 0aba9c8
Avoid evaluating $IsWindows under Strict mode in PS 5.1
PS 5.1 does not define the $IsWindows automatic variable, and the
hidden-folders tests run under Strict mode, so reading it directly
threw 'The variable $IsWindows cannot be retrieved because it has
not been set' in the PS_5_1_Windows_Server2022 leg.
Reorder the check so the version comparison short-circuits before
$IsWindows is touched: in PS 5.1 the first operand is $true and
$IsWindows is never evaluated; in PS 6+ the variable is always set
so reading it is safe.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 28a50b7 commit 0aba9c8
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2980 | 2980 | | |
2981 | 2981 | | |
2982 | 2982 | | |
2983 | | - | |
| 2983 | + | |
| 2984 | + | |
| 2985 | + | |
2984 | 2986 | | |
2985 | 2987 | | |
2986 | 2988 | | |
| |||
3001 | 3003 | | |
3002 | 3004 | | |
3003 | 3005 | | |
3004 | | - | |
| 3006 | + | |
3005 | 3007 | | |
3006 | 3008 | | |
3007 | 3009 | | |
| |||
0 commit comments