Skip to content

Commit

Permalink
Add support for :: in --dir to old CLI (bytecodealliance#7416)
Browse files Browse the repository at this point in the history
In Wasmtime 13 and prior the `--dir` argument was unconditionally used
to open a host dir as the same name and in the guest. In Wasmtime 14+
though this argument is being repurposed with an optional trailing
`::GUEST` to configure the guest directory. This means that
`--dir`-with-remapping behavior is actually unusable without the
environment variable configuration from bytecodealliance#7385 due to it parsing
differently in the old and the new.

This commit updates the situation by adding `::`-parsing to the old CLI
meaning that both the old and the new parse this the same way. This will
break any scripts that open host directories with two colons in their
path, but that seems niche enough we can handle that later.
  • Loading branch information
alexcrichton committed Oct 31, 2023
1 parent fd1e948 commit 4c6661a
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 4c6661a

Please sign in to comment.