Skip to content

Commit

Permalink
feat(deployer): copy instead of move executable
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaro00 committed Oct 18, 2023
1 parent 10df6f5 commit dde96a8
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions deployer/src/deployment/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ impl Queued {
}

info!("Moving built executable");
move_executable(
copy_executable(
built_service.executable_path.as_path(),
built_service
.workspace_path
Expand Down Expand Up @@ -453,13 +453,13 @@ async fn run_pre_deploy_tests(
/// This will store the path to the executable for each runtime, which will be the users project with
/// an embedded runtime for alpha, and a .wasm file for shuttle-next.
#[instrument(skip(executable_path, to_directory, new_filename))]
async fn move_executable(
async fn copy_executable(
executable_path: &Path,
to_directory: &Path,
new_filename: &Uuid,
) -> Result<()> {
fs::create_dir_all(to_directory).await?;
fs::rename(executable_path, to_directory.join(new_filename.to_string())).await?;
fs::copy(executable_path, to_directory.join(new_filename.to_string())).await?;

Ok(())
}
Expand Down Expand Up @@ -605,13 +605,10 @@ ff0e55bda1ff01000000000000000000e0079c01ff12a55500280000",

fs::write(&executable_path, "barfoo").await.unwrap();

super::move_executable(executable_path.as_path(), executables_p, &id)
super::copy_executable(executable_path.as_path(), executables_p, &id)
.await
.unwrap();

// Old executable file gone?
assert!(!executable_path.exists());

assert_eq!(
fs::read_to_string(executables_p.join(id.to_string()))
.await
Expand Down

0 comments on commit dde96a8

Please sign in to comment.