From 4fdb6bbe7a23936bd2f67d2e15e3d746af7f88db Mon Sep 17 00:00:00 2001 From: Zelda Hessler Date: Wed, 29 Dec 2021 14:15:53 -0600 Subject: [PATCH] fix: exit with error code on failure (#1014) add: print directories at start --- tools/smithy-rs-sync/src/main.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/smithy-rs-sync/src/main.rs b/tools/smithy-rs-sync/src/main.rs index 1e59cf9326..7bd7f27d13 100644 --- a/tools/smithy-rs-sync/src/main.rs +++ b/tools/smithy-rs-sync/src/main.rs @@ -59,20 +59,28 @@ pub(crate) use here; /// --smithy-rs /Users/zhessler/Documents/smithy-rs-test/ \ /// --aws-sdk /Users/zhessler/Documents/aws-sdk-rust-test/ /// ``` -fn main() { +fn main() -> Result<()> { let Opt { smithy_rs, aws_sdk, branch, } = Opt::from_args(); - if let Err(e) = sync_aws_sdk_with_smithy_rs(&smithy_rs, &aws_sdk, &branch) { - eprintln!("Sync failed with error: {:?}", e); - }; + sync_aws_sdk_with_smithy_rs(&smithy_rs, &aws_sdk, &branch) + .map_err(|e| e.context("The sync failed")) } /// Run through all commits made to `smithy-rs` since last sync and "replay" them onto `aws-sdk-rust`. fn sync_aws_sdk_with_smithy_rs(smithy_rs: &Path, aws_sdk: &Path, branch: &str) -> Result<()> { + eprintln!( + "aws-sdk-rust path:\t{}", + aws_sdk.canonicalize().context(here!())?.display() + ); + eprintln!( + "smithy-rs path:\t{}", + smithy_rs.canonicalize().context(here!())?.display() + ); + // Open the repositories we'll be working with let smithy_rs_repo = Repository::open(smithy_rs).context("couldn't open smithy-rs repo")?; let aws_sdk_repo = Repository::open(aws_sdk).context("couldn't open aws-sdk-rust repo")?;