fix(cli): standalone bin corruption on M1 (#10311)

This commit is contained in:
Aaron O'Mullan 2021-04-23 12:33:45 +02:00 committed by GitHub
parent 6824ffb999
commit 2d722832c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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)]