pub fn check_passwordless_sudo_available() -> Result<bool, String>Expand description
What: Check if passwordless sudo is available for the current user.
Inputs:
- None (checks system configuration).
Output:
Ok(true)if passwordless sudo is available,Ok(false)if not, orErr(String)on error.
§Errors
- Returns
Errif the check cannot be executed (e.g., sudo not installed).
Details:
- Uses
sudo -n trueto test if sudo can run without password. -n: Non-interactive mode (fails if password required).true: Simple command that always succeeds if sudo works.- Returns
Ok(false)if sudo is not available or requires a password. - Testing: Only when
PACSEA_INTEGRATION_TEST=1is set (test harness), the env varPACSEA_TEST_SUDO_PASSWORDLESSis honored: “1” = available, “0” = unavailable. In production (whenPACSEA_INTEGRATION_TESTis not set),PACSEA_TEST_SUDO_PASSWORDLESSis ignored so the only way to enable passwordless sudo is viause_passwordless_sudoin settings.