diff options
Diffstat (limited to 'cli/tools/standalone.rs')
-rw-r--r-- | cli/tools/standalone.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cli/tools/standalone.rs b/cli/tools/standalone.rs index 180d0bf52..593d99931 100644 --- a/cli/tools/standalone.rs +++ b/cli/tools/standalone.rs @@ -170,6 +170,10 @@ pub async fn write_standalone_binary( if !has_trailer { bail!("Could not compile: cannot overwrite {:?}.", &output); } + + // Remove file if it was indeed a deno compiled binary, to avoid corruption + // (see https://github.com/denoland/deno/issues/10310) + std::fs::remove_file(&output)?; } tokio::fs::write(&output, final_bin).await?; #[cfg(unix)] |