Skip to content

fix: use $PSScriptRoot instead of MyCommand.Path in install.ps1#1166

Merged
chumyin merged 1 commit intoeastreams:devfrom
attolee:fix/install-ps1-psscriptroot
Apr 16, 2026
Merged

fix: use $PSScriptRoot instead of MyCommand.Path in install.ps1#1166
chumyin merged 1 commit intoeastreams:devfrom
attolee:fix/install-ps1-psscriptroot

Conversation

@attolee
Copy link
Copy Markdown
Contributor

@attolee attolee commented Apr 9, 2026

this fixes a powershell source install error where $MyInvocation.MyCommand.Path can be null in some environments.

using $PSScriptRoot is the standard and more reliable way to resolve the script directory on powershell 3.0+.

fixes the failure where install.ps1 -Source can raise:
ParentContainsErrorRecordException: The property Path cannot be found

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d9e1607c-e220-4bf6-927e-6a3f9de0d649

📥 Commits

Reviewing files that changed from the base of the PR and between acec13c and b28a3d5.

📒 Files selected for processing (1)
  • scripts/install.ps1

📝 Walkthrough

Walkthrough

The PowerShell install script now uses $PSScriptRoot directly to determine the script directory instead of deriving it from $MyInvocation.MyCommand.Path. This single-line change simplifies the approach to locating the repository root path during script execution.

Changes

Cohort / File(s) Summary
Script Path Resolution
scripts/install.ps1
Changed $scriptDir initialization from Split-Path -Parent $MyInvocation.MyCommand.Path to $PSScriptRoot for more direct directory detection.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 The script hops faster now, you see,
No winding path through MyInvocation tree,
$PSScriptRoot knows where it ought to be,
A simpler hop, more direct and free! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title mentions replacing 'System.Management.Automation.InvocationInfo.MyCommand.Path' but omits the replacement variable, making it incomplete and unclear what the fix actually introduces. Update the title to explicitly state what $PSScriptRoot is being used for, e.g., 'fix: use $PSScriptRoot instead of MyCommand.Path in install.ps1' for clarity.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added daemon Daemon binary, CLI entrypoints, and install flow. size: XS Tiny pull request: 0-50 changed lines. labels Apr 9, 2026
@attolee attolee force-pushed the fix/install-ps1-psscriptroot branch from 41c8409 to b28a3d5 Compare April 9, 2026 23:55
@attolee attolee marked this pull request as ready for review April 12, 2026 05:25
Copy link
Copy Markdown
Collaborator

@chumyin chumyin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your efforts here! have approved workflows to run, after all CIs are green, it looks good to be merged.

@attolee attolee requested review from a team as code owners April 16, 2026 03:44
@attolee
Copy link
Copy Markdown
Contributor Author

attolee commented Apr 16, 2026

merge dev to solve cargo audit failure.

@chumyin chumyin self-assigned this Apr 16, 2026
@chumyin chumyin changed the title fix: use instead of System.Management.Automation.InvocationInfo.MyCommand.Path in install.ps1 fix: use $PSScriptRoot instead of MyCommand.Path in install.ps1 Apr 16, 2026
@chumyin chumyin force-pushed the fix/install-ps1-psscriptroot branch from 241cb1d to a5bb586 Compare April 16, 2026 12:44
this fixes a powershell source install error where `$MyInvocation.MyCommand.Path` can be null in some environments.

using `$PSScriptRoot` is the standard and more reliable way to resolve the script directory on powershell 3.0+.

fixes the failure where `install.ps1 -Source` can raise:
`ParentContainsErrorRecordException: The property Path cannot be found`
@chumyin chumyin force-pushed the fix/install-ps1-psscriptroot branch from a5bb586 to b894467 Compare April 16, 2026 12:45
@chumyin
Copy link
Copy Markdown
Collaborator

chumyin commented Apr 16, 2026

hey @attolee, thanks for chasing this powershell edge case. i rebased the branch onto current dev, cleaned up the pr title/body so the variable is explicit, and rechecked the thread plus the final diff. the switch to $PSScriptRoot looks right here, so im merging this now. nice catch.

@chumyin chumyin merged commit 98e2e72 into eastreams:dev Apr 16, 2026
3 checks passed
@attolee attolee deleted the fix/install-ps1-psscriptroot branch April 17, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

daemon Daemon binary, CLI entrypoints, and install flow. size: XS Tiny pull request: 0-50 changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants