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 4548922
Show file tree
Hide file tree
Showing 3 changed files with 17 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
5 changes: 5 additions & 0 deletions tui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ struct Args {
}

fn main() -> io::Result<()> {
if sudo::check() != sudo::RunningAs::User {
eprintln!("This program should not be run as root");
std::process::exit(1);
}

let args = Args::parse();

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

0 comments on commit 4548922

Please sign in to comment.