From d9a39cc046f33d1c1c14af98d9662ee5324f3a52 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 23 Dec 2024 19:53:08 -0800 Subject: [PATCH] print output on failure --- src/main.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index a658437..8e6a1e2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -397,7 +397,7 @@ fn upload() -> AResult<()>{ } match upload_action { UploadAction::Upload(asset_id) => { - let status=std::process::Command::new("asset-tool") + let output=std::process::Command::new("asset-tool") .args([ "upload-asset", "--cookie-envvar","RBXCOOKIE", @@ -405,16 +405,17 @@ fn upload() -> AResult<()>{ ]) .arg("--asset-id").arg(asset_id.to_string()) .arg("--input-file").arg(file_thing.path().into_os_string().into_string().unwrap()) - .status()?; - match status.code() { + .output()?; + match output.status.code() { Some(0)=>{ //move file let mut dest=PathBuf::from("maps/uploaded"); dest.push(file_thing.file_name()); std::fs::rename(file_thing.path(), dest)?; } - Some(code)=>println!("upload failed! code={}",code), - None => println!("no status code!"), + other=>{ + println!("upload failed! code={:?}\noutput={}\nerr={}",other,String::from_utf8_lossy(&output.stdout),String::from_utf8_lossy(&output.stderr)); + }, } } UploadAction::Skip => continue, @@ -436,9 +437,10 @@ fn upload() -> AResult<()>{ let mut dest=PathBuf::from("maps/uploaded"); dest.push(file_thing.file_name()); std::fs::rename(file_thing.path(), dest)?; - } - Some(code)=>println!("upload failed! code={}",code), - None => println!("no status code!"), + }, + other=>{ + println!("upload failed! code={:?}\noutput={}\nerr={}",other,String::from_utf8_lossy(&output.stdout),String::from_utf8_lossy(&output.stderr)); + }, } } UploadAction::Delete => std::fs::remove_file(file_thing.path())?,