diff --git a/src/main.rs b/src/main.rs index c1d1239..5e109fb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,6 +21,12 @@ enum Opts { )] copy_back: bool, + #[structopt( + long = "no-copy-lock", + help = "don't transfer the Cargo.lock file back to the local machine" + )] + no_copy_lock: bool, + #[structopt( long = "manifest-path", help = "Path to the manifest to execute", @@ -80,6 +86,7 @@ fn main() { let Opts::Remote { remote, copy_back, + no_copy_lock, manifest_path, hidden, command, @@ -193,4 +200,26 @@ fn main() { exit(-6); }); } + + if !no_copy_lock { + info!("Transferring Cargo.lock file back to client."); + Command::new("rsync") + .arg("-a") + .arg("--delete") + .arg("--compress") + .arg("--info=progress2") + .arg(format!("{}:{}/Cargo.lock", build_server, build_path)) + .arg(format!("{}/Cargo.lock", project_dir.to_string_lossy())) + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()) + .stdin(Stdio::inherit()) + .output() + .unwrap_or_else(|e| { + error!( + "Failed to transfer Cargo.lock back to local machine (error: {})", + e + ); + exit(-6); + }); + } }