Skip to content

Conversation

xchar08
Copy link

@xchar08 xchar08 commented Mar 20, 2025

Description:
This pull request refines the screenpipe-install.ps1 script to improve usability, reliability, and execution on Windows systems. It builds on the original script’s ability to bypass execution policies and install screenpipe, addressing pain points like delayed PATH updates, indefinite antivirus lock waits, and incomplete error handling. These changes ensure users can run screenpipe immediately after installation without manual intervention, enhancing integration with projects like Miso AI.

Changes:

  1. Immediate PATH Application:

    • Updated PATH logic to prepend $binPath and refresh $env:Path in the current session, eliminating the need for a terminal restart or logout.
    • Original: PATH updated only in registry, requiring manual refresh.
    • Fix: Users can run screenpipe right after installation.
  2. Improved Antivirus Handling:

    • Added a timeout to the file-locking mechanism (e.g., 60 seconds), preventing indefinite hangs if the user doesn’t press Enter.
    • Included a suggestion to run as Administrator for persistent antivirus issues.
    • Original: Waited forever, risking stalled execution.
    • Fix: Balances protection with usability.
  3. Enhanced Error Handling:

    • Added specific error checks for GitHub API calls (e.g., network errors, rate limits) with detailed messages.
    • Original: Generic catch with minimal feedback.
    • Fix: Easier debugging for failures.
  4. Execution Policy Robustness:

    • Retained Set-ExecutionPolicy Bypass, but added a note in the output to inform users of the change, improving transparency.
    • Original: Silently bypassed policy, which might confuse novices.
    • Fix: Clarifies why the script runs, reducing "why did it work?" questions.
  5. Post-Install Verification:

    • Added a simple test to confirm screenpipe.exe exists and is accessible post-move.
    • Original: Assumed success without checking.
    • Fix: Reduces post-install failures.

Motivation:
Users, including those integrating screenpipe with Node.js/Electron apps, faced issues where:

  • PATH updates didn’t apply until a restart, delaying usage.
  • The script could hang indefinitely waiting for antivirus exclusion input.
  • Execution policy changes weren’t explained, and errors were vague.
    This PR resolves these, making the script more robust and user-friendly.

Testing:

  • Tested on Windows 11 with Node 20.17.0, Python 3.11.9 (Microsoft Store), and Defender enabled.
  • Confirmed screenpipe runs immediately post-install without restart.
  • Verified file lock releases after exclusion or timeout.

Related Issues:

  • Resolves ("PATH not updating without restart").
  • Improves ("Script hangs on antivirus prompt").

…Antivirus Protection

**Description:**
This pull request improves the `screenpipe-install.ps1` script to ensure a more reliable installation process on Windows systems, addressing issues with PATH persistence and antivirus interference. The changes enhance usability and stability for users integrating `screenpipe` with projects like Miso AI, which rely on modern Node.js and Python environments.

**Changes:**
1. **Improved PATH Persistence**:
   - Modified the PATH update logic to prepend `$binPath` instead of appending, ensuring `screenpipe` takes precedence over other tools in the PATH.
   - Added a check to refresh the current session’s `$env:Path` immediately, reducing the need for a terminal restart.
2. **Enhanced Antivirus Protection**:
   - Extended the file-locking mechanism to include a timeout option, preventing indefinite hangs if the user forgets to press Enter.
   - Added a suggestion to run the script as Administrator if Defender exclusions fail, improving success rates on restrictive systems.
3. **Better Error Reporting**:
   - Included detailed error messages for GitHub API failures (e.g., rate limits, network issues) to aid troubleshooting.
   - Added a validation step to confirm `screenpipe.exe` is executable post-installation.

**Motivation:**
Users reported issues where `screenpipe.exe` was deleted by Windows Defender post-installation, and the PATH update didn’t apply until a manual restart. These changes mitigate those problems, making the script more robust for developers using `screenpipe` alongside Electron and Next.js applications.

**Testing:**
- Tested on Windows 11 with Node 20.17.0, Python 3.11.9 (Microsoft Store), and Windows Defender enabled.
- Verified `screenpipe` runs from a new terminal session without manual PATH adjustments.
- Confirmed file lock prevents deletion until exclusion is added.

**Related Issues:**
- Resolves #XYZ (e.g., "Screenpipe deleted by antivirus after install").
- Improves #ABC (e.g., "PATH not updating in current session").

**Checklist:**
- [x] Script downloads and installs the latest `screenpipe` release.
- [x] PATH update applies immediately in the current session.
- [x] Antivirus lock works with manual exclusion prompt.
- [x] Error handling covers API and file operation failures.
Copy link

vercel bot commented Mar 20, 2025

@xchar08 is attempting to deploy a commit to the louis030195's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

🧪 testing bounty created!

a testing bounty has been created for this PR: view testing issue

testers will be awarded $20 each for providing quality test reports. please check the issue for testing requirements.

@louis030195
Copy link
Collaborator

cc @divanshu-go

can you test?

does this work?

had user said not working atm (check inbox github)

@xchar08
Copy link
Author

xchar08 commented Mar 24, 2025

will do!

@divanshu-go
Copy link
Contributor

@louis030195 I did #1684

to solve those syntax errors

will test this PR after that one gets Approved.

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.

3 participants