Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for :: in --dir to old CLI #7416

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/old_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,10 @@ impl RunCommand {
let mut dirs = Vec::new();

for host in old_dirs {
dirs.push((host.clone(), host));
let mut parts = host.splitn(2, "::");
let host = parts.next().unwrap();
let guest = parts.next().unwrap_or(host);
dirs.push((host.to_string(), guest.to_string()));
}

if preview2 {
Expand Down
13 changes: 13 additions & 0 deletions tests/all/cli_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,19 @@ warning: this CLI invocation of Wasmtime is going to break in the future -- for
);
assert_eq!(String::from_utf8_lossy(&output.stderr), "");

// the `--dir` flag prints no warning when used with `::`
let dir = tempfile::tempdir()?;
std::fs::write(dir.path().join("bar.txt"), b"And stood awhile in thought")?;
let output = get_wasmtime_command()?
.args(&[
"run",
&format!("--dir={}::/", dir.path().to_str().unwrap()),
test_programs_artifacts::CLI_FILE_READ,
])
.output()?;
assert_eq!(String::from_utf8_lossy(&output.stdout), "");
assert_eq!(String::from_utf8_lossy(&output.stderr), "");

Ok(())
}

Expand Down