mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 20:50:06 +00:00
When Mole is called from GUI applications (e.g., SwiftUI apps), the request_sudo_access() function would fail with '/dev/tty: Device not configured' error because /dev/tty is not available in non-TTY contexts. This commit adds automatic detection of the runtime environment and uses macOS native password dialog (via osascript) when running in GUI mode, while preserving all existing TTY behavior including Touch ID support. Changes: - Detect TTY availability before attempting terminal-based authentication - Use osascript to display native password dialog in GUI mode - Maintain backward compatibility with all terminal-based workflows - Ensure secure password handling (unset after use) Fixes commands like 'mole clean', 'mole optimize', 'mole purge' when invoked from GUI applications.
10 KiB
10 KiB