Skip to content

Commit 4672b30

Browse files
fix(cli): log warnings when chmod/chown fails during onboard (#12)
1 parent a4cde2e commit 4672b30

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

‎src/main.rs‎

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::io::{BufRead, BufReader};
33
use std::net::SocketAddr;
44
use std::path::PathBuf;
55
use tokio::signal;
6-
use tracing::{debug, info};
6+
use tracing::{debug, info, warn};
77

88
use clawshell::cli::{Cli, Commands};
99
use clawshell::config::Config;
@@ -498,19 +498,31 @@ fn cmd_onboard() -> Result<(), Box<dyn std::error::Error>> {
498498
"clawshell:clawshell"
499499
};
500500

501-
let _ = std::process::Command::new("chmod")
501+
if let Err(e) = std::process::Command::new("chmod")
502502
.args(["0700", &config_dir.to_string_lossy()])
503-
.status();
504-
let _ = std::process::Command::new("chown")
503+
.status()
504+
{
505+
warn!(path = %config_dir.display(), error = %e, "Failed to chmod config directory");
506+
}
507+
if let Err(e) = std::process::Command::new("chown")
505508
.args(["-R", chown_spec, &config_dir.to_string_lossy()])
506-
.status();
507-
let _ = std::process::Command::new("chown")
509+
.status()
510+
{
511+
warn!(path = %config_dir.display(), error = %e, "Failed to chown config directory");
512+
}
513+
if let Err(e) = std::process::Command::new("chown")
508514
.args(["-R", chown_spec, &log_dir_path.to_string_lossy()])
509-
.status();
515+
.status()
516+
{
517+
warn!(path = %log_dir_path.display(), error = %e, "Failed to chown log directory");
518+
}
510519
if let Some(pid_parent) = pid_path.parent() {
511-
let _ = std::process::Command::new("chown")
520+
if let Err(e) = std::process::Command::new("chown")
512521
.args([chown_spec, &pid_parent.to_string_lossy()])
513-
.status();
522+
.status()
523+
{
524+
warn!(path = %pid_parent.display(), error = %e, "Failed to chown PID directory");
525+
}
514526
}
515527
tui::print_step_done(3, TOTAL_STEPS, "Permissions set");
516528

0 commit comments

Comments
 (0)