summaryrefslogtreecommitdiff
path: root/cli/main.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-03-28 14:38:15 -0400
committerGitHub <noreply@github.com>2022-03-28 14:38:15 -0400
commit89dd5dac6219f9a4c04ada4b5a9c812a88c1c2d4 (patch)
tree529a01aa8cb965142530afd981537ff4d1b23268 /cli/main.rs
parent35cdf4926d941fb054e738390fbb829ba83b4393 (diff)
chore: fix compile_windows_ext test (#14142)
Diffstat (limited to 'cli/main.rs')
-rw-r--r--cli/main.rs24
1 files changed, 4 insertions, 20 deletions
diff --git a/cli/main.rs b/cli/main.rs
index 214b7c2fe..49ad7f519 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -70,7 +70,6 @@ use crate::proc_state::ProcState;
use crate::resolver::ImportMapResolver;
use crate::resolver::JsxResolver;
use crate::source_maps::apply_source_map;
-use crate::tools::installer::infer_name_from_url;
use deno_ast::MediaType;
use deno_core::error::generic_error;
use deno_core::error::AnyError;
@@ -423,18 +422,8 @@ async fn compile_command(
let ps = ProcState::build(Arc::new(flags)).await?;
let deno_dir = &ps.dir;
- let output = compile_flags.output.as_ref().and_then(|output| {
- if fs_util::path_has_trailing_slash(output) {
- let infer_file_name = infer_name_from_url(&module_specifier).map(PathBuf::from)?;
- Some(output.join(infer_file_name))
- } else {
- Some(output.to_path_buf())
- }
- }).or_else(|| {
- infer_name_from_url(&module_specifier).map(PathBuf::from)
- }).ok_or_else(|| generic_error(
- "An executable name was not provided. One could not be inferred from the URL. Aborting.",
- ))?;
+ let output_path =
+ tools::standalone::resolve_compile_executable_output_path(&compile_flags)?;
let graph = Arc::try_unwrap(
create_graph_and_maybe_check(module_specifier.clone(), &ps, debug).await?,
@@ -467,14 +456,9 @@ async fn compile_command(
)
.await?;
- info!("{} {}", colors::green("Emit"), output.display());
+ info!("{} {}", colors::green("Emit"), output_path.display());
- tools::standalone::write_standalone_binary(
- output.clone(),
- compile_flags.target,
- final_bin,
- )
- .await?;
+ tools::standalone::write_standalone_binary(output_path, final_bin).await?;
Ok(0)
}