mirror of
https://github.com/denoland/deno.git
synced 2025-03-08 12:19:02 -05:00
fix(compile): never include the specified output executable in itself
This commit is contained in:
parent
b7456fed70
commit
ee0cecea29
1 changed files with 10 additions and 1 deletions
|
@ -37,7 +37,7 @@ pub async fn compile(
|
||||||
let binary_writer = factory.create_compile_binary_writer().await?;
|
let binary_writer = factory.create_compile_binary_writer().await?;
|
||||||
let http_client = factory.http_client_provider();
|
let http_client = factory.http_client_provider();
|
||||||
let entrypoint = cli_options.resolve_main_module()?;
|
let entrypoint = cli_options.resolve_main_module()?;
|
||||||
let (module_roots, include_files) = get_module_roots_and_include_files(
|
let (module_roots, mut include_files) = get_module_roots_and_include_files(
|
||||||
entrypoint,
|
entrypoint,
|
||||||
&compile_flags,
|
&compile_flags,
|
||||||
cli_options.initial_cwd(),
|
cli_options.initial_cwd(),
|
||||||
|
@ -91,6 +91,15 @@ pub async fn compile(
|
||||||
);
|
);
|
||||||
validate_output_path(&output_path)?;
|
validate_output_path(&output_path)?;
|
||||||
|
|
||||||
|
let file_index = include_files.iter().position(|file_included| {
|
||||||
|
file_included
|
||||||
|
.path()
|
||||||
|
.ends_with(output_path.to_str().unwrap().replace(" ", "%20").as_str())
|
||||||
|
});
|
||||||
|
if let Some(index) = file_index {
|
||||||
|
include_files.remove(index);
|
||||||
|
}
|
||||||
|
|
||||||
let mut temp_filename = output_path.file_name().unwrap().to_owned();
|
let mut temp_filename = output_path.file_name().unwrap().to_owned();
|
||||||
temp_filename.push(format!(
|
temp_filename.push(format!(
|
||||||
".tmp-{}",
|
".tmp-{}",
|
||||||
|
|
Loading…
Add table
Reference in a new issue