From 98904572698b60de566a5283d25b868cd3ef2abf Mon Sep 17 00:00:00 2001 From: arctic_hen7 Date: Fri, 17 Sep 2021 11:51:50 +1000 Subject: [PATCH] =?UTF-8?q?fix(cli):=20=F0=9F=90=9B=20fixed=20cli=20`--no-?= =?UTF-8?q?build`=20option?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No longer deletes build artifacts or tries to finalize (both of which cause a failure). --- packages/perseus-cli/src/bin/main.rs | 6 ++++-- packages/perseus-cli/src/serve.rs | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/perseus-cli/src/bin/main.rs b/packages/perseus-cli/src/bin/main.rs index 6522715aca..cc6851697b 100644 --- a/packages/perseus-cli/src/bin/main.rs +++ b/packages/perseus-cli/src/bin/main.rs @@ -81,8 +81,10 @@ fn core(dir: PathBuf) -> Result { } else if prog_args[0] == "serve" { // Set up the '.perseus/' directory if needed prepare(dir.clone())?; - // Delete old build artifacts - delete_artifacts(dir.clone())?; + // Delete old build artifacts if `--no-build` wasn't specified + if !prog_args.contains(&"--no-build".to_string()) { + delete_artifacts(dir.clone())?; + } let exit_code = serve(dir, &prog_args)?; Ok(exit_code) } else if prog_args[0] == "prep" { diff --git a/packages/perseus-cli/src/serve.rs b/packages/perseus-cli/src/serve.rs index 9466b86475..a5edb6f048 100644 --- a/packages/perseus-cli/src/serve.rs +++ b/packages/perseus-cli/src/serve.rs @@ -173,7 +173,7 @@ pub fn serve(dir: PathBuf, prog_args: &[String]) -> Result { // We can begin building the server in a thread without having to deal with the rest of the build stage yet let sb_thread = build_server(dir.clone(), &spinners, did_build, Arc::clone(&exec))?; // Only build if the user hasn't set `--no-build`, handling non-zero exit codes - if !prog_args.contains(&"--no-build".to_string()) { + if did_build { let (sg_thread, wb_thread) = build_internal(dir.clone(), &spinners, 4)?; let sg_res = sg_thread .join() @@ -195,10 +195,10 @@ pub fn serve(dir: PathBuf, prog_args: &[String]) -> Result { return Ok(sb_res); } - // This waits for all the threads and lets the spinners draw to the terminal - // spinners.join().map_err(|_| ErrorKind::ThreadWaitFailed)?; - // And now we can run the finalization stage - finalize(&dir.join(".perseus"))?; + // And now we can run the finalization stage (only if `--no-build` wasn't specified) + if did_build { + finalize(&dir.join(".perseus"))?; + } // Now actually run that executable path let exit_code = run_server(Arc::clone(&exec), dir.clone(), did_build)?;