feat(scoop-update): add --allow-running flag to bypass running-process check - #6661
feat(scoop-update): add --allow-running flag to bypass running-process check#6661B67687 wants to merge 3 commits into
Conversation
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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe PR adds a new ChangesAllow-running flag for process bypass
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
CHANGELOG.mdlibexec/scoop-update.ps1
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.
Description
Adds
-r, --allow-runningflag toscoop updatethat temporarily setsIGNORE_RUNNING_PROCESSES $truefor 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_PROCESSESconfig 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.Motivation and Context
Updating pwsh (or any scoop-managed app that is currently running) has required users to either:
IGNORE_RUNNING_PROCESSESconfig, update, then unset itThe scoop pwsh manifest itself notes: "Since Scoop uses pwsh.exe internally, to update PowerShell Core itself, run
scoop update pwshfrom 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?
scoop update pwshwithIGNORE_RUNNING_PROCESSESset correctly creates a new version directory (7.6.2/) while the old binary (7.6.1/) continues runningcurrentjunction is updated to point to the new version--skip-hash-checkand other flags still work alongside--allow-runningChecklist:
developbranch.Summary by CodeRabbit
-r/--allow-runningflag to thescoop updatecommand. When used, updates can proceed even if other applications are running; the tool automatically preserves and restores relevant configuration settings after the update completes.