Skip to content

Fix PowerShell variable assignment with subexpression operator#32

Merged
CodeWithJuber merged 1 commit into
mainfrom
claude/fix-install-script-RN77N
Mar 6, 2026
Merged

Fix PowerShell variable assignment with subexpression operator#32
CodeWithJuber merged 1 commit into
mainfrom
claude/fix-install-script-RN77N

Conversation

@CodeWithJuber

Copy link
Copy Markdown
Owner

Summary

This PR fixes PowerShell variable assignments by wrapping conditional expressions in the subexpression operator $(). This ensures proper evaluation and assignment of the conditional results to variables.

Key Changes

  • Wrapped if-else expressions in subexpression operator $() for $MizanMethod, $MizanDir, and $MizanBranch variable assignments
  • Applied the same fix to the $arch variable assignment in the Get-Platform function

Implementation Details

The subexpression operator $() forces PowerShell to evaluate the entire expression and return its result before assignment. Without it, the variable assignment may not properly capture the conditional result, potentially leading to unexpected behavior or type issues. This is a best practice in PowerShell for ensuring reliable variable initialization with complex expressions.

https://claude.ai/code/session_01HfYjYPU2SBFdzSxMKF5ruf

Wrap bare `if` expression assignments in $() subexpressions for
compatibility with Windows PowerShell 5.1, which doesn't support
`if` as an expression on the RHS of assignments without $().

https://claude.ai/code/session_01HfYjYPU2SBFdzSxMKF5ruf
@CodeWithJuber
CodeWithJuber merged commit e54b693 into main Mar 6, 2026
1 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants