fix(composer): spawn commands to allow interaction #71

Merged
letian merged 2 commits from fix/harmony-compose-deploy-output into master 2025-07-01 21:08:27 +00:00

View File

@ -73,10 +73,9 @@ async fn main() {
.try_exists() .try_exists()
.expect("couldn't check if path exists"); .expect("couldn't check if path exists");
let harmony_bin_path: PathBuf; let harmony_bin_path: PathBuf = match harmony_path {
match harmony_path {
true => { true => {
harmony_bin_path = compile_harmony( compile_harmony(
cli_args.compile_method, cli_args.compile_method,
cli_args.compile_platform, cli_args.compile_platform,
cli_args.harmony_path.clone(), cli_args.harmony_path.clone(),
@ -84,7 +83,7 @@ async fn main() {
.await .await
} }
false => todo!("implement autodetect code"), false => todo!("implement autodetect code"),
} };
match cli_args.command { match cli_args.command {
Some(command) => match command { Some(command) => match command {
@ -103,8 +102,10 @@ async fn main() {
}; };
let check_output = Command::new(check_script) let check_output = Command::new(check_script)
.output() .spawn()
.expect("failed to run check script"); .expect("failed to run check script")
.wait_with_output()
.unwrap();
info!( info!(
"check stdout: {}, check stderr: {}", "check stdout: {}, check stderr: {}",
String::from_utf8(check_output.stdout).expect("couldn't parse from utf8"), String::from_utf8(check_output.stdout).expect("couldn't parse from utf8"),
@ -112,18 +113,16 @@ async fn main() {
); );
} }
Commands::Deploy(args) => { Commands::Deploy(args) => {
if args.staging { let deploy = if args.staging {
todo!("implement staging deployment"); todo!("implement staging deployment")
} else if args.prod {
todo!("implement prod deployment")
} else {
Command::new(harmony_bin_path).arg("-y").arg("-a").spawn()
} }
.expect("failed to run harmony deploy");
if args.prod { let deploy_output = deploy.wait_with_output().unwrap();
todo!("implement prod deployment");
}
let deploy_output = Command::new(harmony_bin_path)
.arg("-y")
.arg("-a")
.output()
.expect("failed to run harmony deploy");
println!( println!(
"deploy output: {}", "deploy output: {}",
String::from_utf8(deploy_output.stdout).expect("couldn't parse from utf8") String::from_utf8(deploy_output.stdout).expect("couldn't parse from utf8")