print output on failure

This commit is contained in:
Quaternions 2024-12-23 19:53:08 -08:00
parent c9d58fb7ca
commit d9a39cc046

View File

@ -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())?,