From 2d722832c4382c20c2f889456affa0e9b6a58d7d Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Fri, 23 Apr 2021 12:33:45 +0200 Subject: fix(cli): standalone bin corruption on M1 (#10311) --- cli/tools/standalone.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cli/tools') 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)] -- cgit v1.2.3