Skip to content

Conversation

@art049
Copy link
Member

@art049 art049 commented Oct 18, 2025

Summary

This PR improves the handling of interactive sudo password prompts to provide a better user experience when sudo privileges are required.

Changes

1. Pre-validation of sudo access

  • Added validate_sudo_access() function that checks if sudo requires a password
  • If a password is needed, the progress bar is suspended and the user is prompted interactively
  • Uses sudo --validate to cache credentials upfront

2. Proper progress bar suspension

  • Modified suspend_progress_bar() in src/local_logger.rs:30 to use try_lock() instead of lock() to prevent deadlocks on reentrant calls
  • This allows the progress bar to be suspended when prompting for the sudo password without causing a deadlock

3. Centralized sudo command creation

  • Added validated_sudo_command() function that validates sudo access first, then creates a Command with the --non-interactive flag
  • This ensures password prompts don't appear unexpectedly after validation
  • Updated all sudo usage to use this centralized function

4. Improved error handling

  • Better error messages when sudo authentication fails
  • Clear user-facing message: "Sudo privileges are required to continue. Please enter your password if prompted."

@art049 art049 force-pushed the feat/proper-interactive-sudo-support branch from 4273ef0 to b9a0aa2 Compare October 18, 2025 00:32
@art049 art049 force-pushed the feat/proper-interactive-sudo-support branch from 8870b0a to d5fae3d Compare October 20, 2025 12:00
@art049 art049 merged commit d5fae3d into main Oct 20, 2025
3 checks passed
@art049 art049 deleted the feat/proper-interactive-sudo-support branch October 20, 2025 12:00
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