Skip to content

refactor!: guard install flow against dot-sourcing - #136

Merged
chawyehsu merged 3 commits into
ScoopInstaller:masterfrom
chawyehsu:push-slptlxvpszwn
Aug 27, 2026
Merged

refactor!: guard install flow against dot-sourcing#136
chawyehsu merged 3 commits into
ScoopInstaller:masterfrom
chawyehsu:push-slptlxvpszwn

Conversation

@chawyehsu

@chawyehsu chawyehsu commented Aug 27, 2026

Copy link
Copy Markdown
Member

This COULD be a BREAKING CHANGE, as the behavior has changed.

This PR adjusts the execution prerequisites for the installer's core install flow. When the installer is imported via dot-sourcing (i.e., . .\install.ps1), the install flow will no longer run. This aligns with the intended behavior and distinguishes between simply importing functions defined in the installer via dot-sourcing, and directly executing the installer.

This change was prompted by a CI error in #135, tests should not execute the install flow.

Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>
Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9aab3059-6bd4-4e72-ad9a-03e1ced8e1db

📥 Commits

Reviewing files that changed from the base of the PR and between 53829d1 and a36b3c4.

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

Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review.


Summary by CodeRabbit

  • Bug Fixes

    • Improved installer error handling so failures stop installation consistently while preserving the previous PowerShell error preference.
    • Prevented installation steps from running when the installer is loaded rather than executed directly.
    • Moved language-mode validation into the installer execution checks.
    • Improved prerequisite validation before applying proxy settings.
  • Tests

    • Updated installer test setup to use isolated temporary directories for local and global installations.

Walkthrough

Changes

The installer checks prerequisites before parameter validation and temporarily uses terminating errors during direct execution. Tests assign Scoop paths directly from $TestDrive.

Changes

Installer behavior

Layer / File(s) Summary
Installer execution flow
install.ps1
Install-Scoop checks prerequisites before validating parameters. Direct execution sets $ErrorActionPreference to Stop for the install flow and restores the previous value afterward.
Test environment initialization
test/install.Tests.ps1
Tests assign SCOOP and SCOOP_GLOBAL directly from Join-Path expressions under $TestDrive.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the main change: guarding the install flow against dot-sourcing.
Description check ✅ Passed The description directly explains the dot-sourcing behavior change, its impact, and the related CI issue.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eaa45aa4-9822-49df-8ad6-60492464dcd3

📥 Commits

Reviewing files that changed from the base of the PR and between 3f16afb and a26a560.

📒 Files selected for processing (2)
  • install.ps1
  • test/install.Tests.ps1

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread install.ps1 Outdated
Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>
@chawyehsu
chawyehsu merged commit a621092 into ScoopInstaller:master Aug 27, 2026
4 checks passed
robobun added a commit to oven-sh/WebKit that referenced this pull request Aug 27, 2026
…ession

ScoopInstaller/Install#136 (2026-08-27) made install.ps1 skip the install
flow when it is dot-sourced: the script now only calls Install-Scoop when
$MyInvocation.InvocationName is not '.'. GitHub Actions runs a pwsh step by
dot-sourcing the step script, so `irm get.scoop.sh | iex` inherits that
invocation name, defines the functions and exits without installing. The
next step then fails on `scoop config` within a second. Every Preview Build
and release build in this repository has failed that way on the
windows-11-arm job since 09:48 UTC.

Download the installer to a file and run it with the call operator, whose
invocation name is the file path, and fail the step if scoop.ps1 is not in
the shims directory afterwards.
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.

1 participant