Skip to content

Commit

Permalink
Add root check
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevithakannan2 committed Oct 13, 2024
1 parent 79eb752 commit c997a3d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ tree-sitter-highlight = "0.24.2"
tree-sitter-bash = "0.23.1"
anstyle = "1.0.8"
ansi-to-tui = "6.0.0"
sudo = "0.6.0"
zips = "0.1.7"

[build-dependencies]
Expand Down
6 changes: 6 additions & 0 deletions tui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ struct Args {
}

fn main() -> io::Result<()> {
if sudo::check() != sudo::RunningAs::User {
eprintln!("Error: This program is not intended to be run with elevated privileges.");
eprintln!("Please run this program as a regular user to ensure proper security and functionality.");
std::process::exit(1);
}

let args = Args::parse();

let mut state = AppState::new(args.theme, args.override_validation);
Expand Down

0 comments on commit c997a3d

Please sign in to comment.