Skip to content

feat(scoop-update): add --allow-running flag to bypass running-process check - #6661

Open
B67687 wants to merge 3 commits into
ScoopInstaller:developfrom
B67687:feat/allow-running-flag
Open

feat(scoop-update): add --allow-running flag to bypass running-process check#6661
B67687 wants to merge 3 commits into
ScoopInstaller:developfrom
B67687:feat/allow-running-flag

Conversation

@B67687

@B67687 B67687 commented May 22, 2026

Copy link
Copy Markdown

Description

Adds -r, --allow-running flag to scoop update that temporarily sets IGNORE_RUNNING_PROCESSES $true for the duration of the update command, then restores the previous value.

This is safe for apps installed in versioned directories (e.g., pwsh, most portable apps), where the update creates a new version directory without touching the running binary. The existing IGNORE_RUNNING_PROCESSES config already handles this case — this flag simply exposes it as a one-shot CLI option so users don't need to toggle a global config.

# Before: requires manual config toggle
scoop config IGNORE_RUNNING_PROCESSES $true
scoop update pwsh
scoop config IGNORE_RUNNING_PROCESSES $false

# After: single command
scoop update pwsh --allow-running

Motivation and Context

Updating pwsh (or any scoop-managed app that is currently running) has required users to either:

  1. Close all instances of the app first
  2. Set the global IGNORE_RUNNING_PROCESSES config, update, then unset it

The scoop pwsh manifest itself notes: "Since Scoop uses pwsh.exe internally, to update PowerShell Core itself, run scoop update pwsh from Windows PowerShell." But even from Windows PowerShell, the running-process check can still block the update because the current pwsh.exe session matches the app directory.

For versioned-install apps like pwsh, the update is safe because scoop creates a new version directory (e.g., 7.6.2/) without modifying the old directory (7.6.1/) where the running binary lives. The user merely needs to restart the app.

Closes #6342
Relates to #6029, #4713, #5799

How Has This Been Tested?

  • Verified that scoop update pwsh with IGNORE_RUNNING_PROCESSES set correctly creates a new version directory (7.6.2/) while the old binary (7.6.1/) continues running
  • Verified that the current junction is updated to point to the new version
  • Verified that the old --skip-hash-check and other flags still work alongside --allow-running
  • Tested both single-app and bulk update paths (the config is set before the update loop and restored afterward)

Checklist:

  • I have read the Contributing Guide.
  • I have ensured that I am targeting the develop branch.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.
  • I have added an entry in the CHANGELOG.

Summary by CodeRabbit

  • New Features
    • Added a -r/--allow-running flag to the scoop update command. When used, updates can proceed even if other applications are running; the tool automatically preserves and restores relevant configuration settings after the update completes.

Review Change Stack

B67687 added 2 commits May 22, 2026 08:03
Adds  to Updating Scoop...
Updating Buckets...
Scoop was updated successfully!
 that temporarily sets
 for the duration of the update command,
then restores the previous value.

This is safe for apps installed in versioned directories (e.g., pwsh),
where the update creates a new version directory without touching the
running binary. The user only needs to restart the app to use the new
version.

Use case:
  scoop update pwsh --allow-running

Closes: ScoopInstaller#6342, ScoopInstaller#6029
Refs: ScoopInstaller#4713, ScoopInstaller#5799
@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4e2bd99f-083a-4955-afc2-fc90f4a58cd0

📥 Commits

Reviewing files that changed from the base of the PR and between bb5d045 and 1ace31c.

📒 Files selected for processing (1)
  • libexec/scoop-update.ps1

Walkthrough

The PR adds a new --allow-running flag to scoop update. The script documents and parses the flag, and when used it saves the current IGNORE_RUNNING_PROCESSES, sets it to $true for the update, then restores the prior value (or $false) in a finally block.

Changes

Allow-running flag for process bypass

Layer / File(s) Summary
Feature interface and option parsing
libexec/scoop-update.ps1, CHANGELOG.md
Help text documents the new -r/--allow-running flag; getopt parsing accepts -r/--allow-running and $allowRunning is introduced; changelog entry added.
Config state management
libexec/scoop-update.ps1
When $allowRunning is set the script saves IGNORE_RUNNING_PROCESSES, sets it to $true before the main update flow (including update tracking initialization), and restores the saved value or $false in a finally block after updates complete.

Sequence Diagram

sequenceDiagram
  participant User
  participant scoop_update as scoop update
  participant Config
  User->>scoop_update: scoop update --allow-running
  scoop_update->>Config: Read IGNORE_RUNNING_PROCESSES
  Note over Config: Save prior value
  scoop_update->>Config: Set IGNORE_RUNNING_PROCESSES = true
  scoop_update->>scoop_update: Perform update flow (initialize tracking, update packages)
  scoop_update->>Config: Restore IGNORE_RUNNING_PROCESSES to saved value or false
  scoop_update->>User: Update complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit tiptoes past the lock and spring,
A tiny flag lets running processes sing.
Save the state, flip it true, then mend—
Restore the world before the end. 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a --allow-running flag to scoop-update to bypass the running-process check, which is directly supported by the code changes in libexec/scoop-update.ps1 and CHANGELOG.md.
Linked Issues check ✅ Passed The PR implements the primary objective from #6342 by adding a CLI flag to bypass the running-process check, enabling users to update pwsh without permanently changing global configuration.
Out of Scope Changes check ✅ Passed All changes are within scope: the CHANGELOG entry and the --allow-running flag implementation directly address the linked issue #6342 with no extraneous modifications.
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.

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@libexec/scoop-update.ps1`:
- Around line 47-50: Move the IGNORE_RUNNING_PROCESSES config change so it only
happens when we actually perform updates (inside the else block that begins at
the update logic) and protect restoration with a try/finally: when $allowRunning
is true, call get_config IGNORE_RUNNING_PROCESSES and set_config
IGNORE_RUNNING_PROCESSES $true before entering the update steps, wrap the
existing update logic in try, and in finally restore IGNORE_RUNNING_PROCESSES
via set_config using the saved value (or $false if none); this ensures
$allowRunning, get_config and set_config calls are only made for real updates
and are always restored even on early exits/abort.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3bd229ab-531a-4489-8ddd-ff9a3d250616

📥 Commits

Reviewing files that changed from the base of the PR and between cbd7c64 and bb5d045.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • libexec/scoop-update.ps1

Comment thread libexec/scoop-update.ps1 Outdated
Addresses CodeRabbit review: the IGNORE_RUNNING_PROCESSES config change
should only happen when actually performing app updates (inside the
else block), not at the script top level. Wrapping in try/finally
ensures the config is always restored even on early exits or errors.
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