summaryrefslogtreecommitdiff
path: root/cli/main.rs
diff options
context:
space:
mode:
authorRabin Gaire <rabingaire20@gmail.com>2022-01-11 10:09:39 +0545
committerGitHub <noreply@github.com>2022-01-10 23:24:39 -0500
commit605b8db8f61fc4c0c71d11cde873af18d87c49bf (patch)
tree63ecb48a02e2549aa8db941ecdd95147843a7b36 /cli/main.rs
parentb66afa2518042cda239ef07f221722781ca660f6 (diff)
cli(compile): fix output flag behaviour on compile command (#13299)
Diffstat (limited to 'cli/main.rs')
-rw-r--r--cli/main.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/cli/main.rs b/cli/main.rs
index f4800b72a..d8e4c4a70 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -378,7 +378,14 @@ async fn compile_command(
let ps = ProcState::build(flags.clone()).await?;
let deno_dir = &ps.dir;
- let output = compile_flags.output.or_else(|| {
+ let output = compile_flags.output.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)
+ }
+ }).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.",