fix(bootstrap): Suppress all subprocess output to prevent console UI corruption

- Redirect Vault exec_cmd output to logs/vault.log
- Add stdout/stderr null pipes to component spawn in installer.rs
- Suppress output in run_commands() in facade.rs
- All component output now goes to respective log files in logs/
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2025-12-09 01:09:04 -03:00
parent ffdc39a6fd
commit 49d1d0cf2e
3 changed files with 19 additions and 16 deletions

View file

@ -1,7 +1,7 @@
{
"base_url": "http://localhost:8080",
"default_org": {
"id": "350217359614541838",
"id": "350233021212786702",
"name": "default",
"domain": "default.localhost"
},
@ -13,8 +13,8 @@
"first_name": "Admin",
"last_name": "User"
},
"admin_token": "MPMhGsichldNO5Aw7vdM57CciCeU6Kl8lu736BuLwfMgJ3K4YLFGEUK-5h2MPM3x7ZHxc74",
"admin_token": "OPPlIuGyjrDYtM2D5SlIWiGOlt9QSjLzQre-QYaRO8jwkQdZa3f3zvsZihoCkq-cBwQ0gio",
"project_id": "",
"client_id": "350217360168255502",
"client_secret": "6jVliHfRDxcocVeQxGybjMR2E5lnX0q3J7Z7Pfsegg66hrzDlrXCKhYzEyHtZdMF"
"client_id": "350233021783277582",
"client_secret": "zQbganbJqEnqjt0y565aL3TeF02WHGmjX2EYQfssja4SoKLBiOFwfcKUM7kWpbp8"
}

View file

@ -563,19 +563,15 @@ impl PackageManager {
.replace("{{DB_PASSWORD}}", &db_password);
if target == "local" {
trace!("Executing command: {}", rendered_cmd);
let child = Command::new("bash")
let output = Command::new("bash")
.current_dir(&bin_path)
.args(&["-c", &rendered_cmd])
.spawn()
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::piped())
.output()
.with_context(|| {
format!("Failed to spawn command for component '{}'", component)
format!("Failed to execute command for component '{}'", component)
})?;
let output = child.wait_with_output().with_context(|| {
format!(
"Failed while waiting for command to finish for component '{}'",
component
)
})?;
if !output.status.success() {
error!(
"Command had non-zero exit: {}",

View file

@ -755,9 +755,9 @@ impl PackageManager {
env
},
data_download_list: Vec::new(),
exec_cmd: "{{BIN_PATH}}/vault server -config={{CONF_PATH}}/vault/config.hcl"
exec_cmd: "nohup {{BIN_PATH}}/vault server -config={{CONF_PATH}}/vault/config.hcl > {{LOGS_PATH}}/vault.log 2>&1 &"
.to_string(),
check_cmd: "curl -f -k https://localhost:8200/v1/sys/health >/dev/null 2>&1"
check_cmd: "curl -f -s http://localhost:8200/v1/sys/health?standbyok=true&uninitcode=200&sealedcode=200 >/dev/null 2>&1"
.to_string(),
},
);
@ -911,6 +911,8 @@ impl PackageManager {
.arg("-c")
.arg(&rendered_cmd)
.envs(&evaluated_envs)
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null())
.spawn();
std::thread::sleep(std::time::Duration::from_secs(2));
@ -927,7 +929,12 @@ impl PackageManager {
"Component {} may already be running, continuing anyway",
component.name
);
Ok(std::process::Command::new("sh").arg("-c").spawn()?)
Ok(std::process::Command::new("sh")
.arg("-c")
.arg("true")
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null())
.spawn()?)
} else {
Err(e.into())
}