Skip to content

Commit

Permalink
Maybe fix mac.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Feb 15, 2022
1 parent c8a8aa5 commit 3d097a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
9 changes: 5 additions & 4 deletions cli/tests/integration/vendor_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use deno_core::serde_json;
use deno_core::serde_json::json;
use deno_runtime::fs_util;
use pretty_assertions::assert_eq;
use std::fs;
use std::process::Stdio;
Expand Down Expand Up @@ -30,11 +31,11 @@ fn output_dir_exists() {
String::from_utf8_lossy(&output.stderr).trim(),
format!(
concat!(
"error: Directory {} was not empty. Please provide an empty ",
"error: Output directory {} was not empty. Please provide an empty ",
"directory or use --force to ignore this error and potentially ",
"overwrite its contents.",
),
vendor_dir.display(),
fs_util::canonicalize_path(&vendor_dir).unwrap().display(),
),
);
assert!(!output.status.success());
Expand All @@ -55,11 +56,11 @@ fn output_dir_exists() {
String::from_utf8_lossy(&output.stderr).trim(),
format!(
concat!(
"error: Directory {} was not empty. Please provide an empty ",
"error: Output directory {} was not empty. Please provide an empty ",
"directory or use --force to ignore this error and potentially ",
"overwrite its contents.",
),
vendor_dir.display(),
fs_util::canonicalize_path(&vendor_dir).unwrap().display(),
),
);
assert!(!output.status.success());
Expand Down
16 changes: 11 additions & 5 deletions cli/tools/vendor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,18 @@ fn resolve_and_validate_output_dir(
flags: &VendorFlags,
ps: &ProcState,
) -> Result<PathBuf, AnyError> {
let output_dir = match &flags.output_path {
Some(output_path) => resolve_from_cwd(output_path)?,
None => std::env::current_dir()?.join("vendor"),
};
let output_dir = resolve_from_cwd(&match &flags.output_path {
Some(output_path) => output_path.to_owned(),
None => PathBuf::from("vendor"),
})?;
if !flags.force && !is_dir_empty(&output_dir)? {
bail!("Directory {} was not empty. Please provide an empty directory or use --force to ignore this error and potentially overwrite its contents.", output_dir.display());
bail!(
concat!(
"Output directory {} was not empty. Please provide an empty directory or use ",
"--force to ignore this error and potentially overwrite its contents.",
),
output_dir.display(),
);
}

// check the import map
Expand Down

0 comments on commit 3d097a5

Please sign in to comment.