@@ -1007,10 +1007,25 @@ fn runCommand(
1007
1007
},
1008
1008
.wasmtime = > | bin_name | {
1009
1009
if (b .enable_wasmtime ) {
1010
+ // https://github.com/bytecodealliance/wasmtime/issues/7384
1011
+ //
1012
+ // In Wasmtime versions prior to 14, options passed after the module name
1013
+ // could be interpreted by Wasmtime if it recognized them. As with many CLI
1014
+ // tools, the `--` token is used to stop that behavior and indicate that the
1015
+ // remaining arguments are for the WASM program being executed. Historically,
1016
+ // we passed `--` after the module name here.
1017
+ //
1018
+ // After version 14, the `--` can no longer be passed after the module name,
1019
+ // but is also not necessary as Wasmtime will no longer try to interpret
1020
+ // options after the module name. So, we could just simply omit `--` for
1021
+ // newer Wasmtime versions. But to maintain compatibility for older versions
1022
+ // that still try to interpret options after the module name, we have moved
1023
+ // the `--` before the module name. This appears to work for both old and
1024
+ // new Wasmtime versions.
1010
1025
try interp_argv .append (bin_name );
1011
1026
try interp_argv .append ("--dir=." );
1012
- try interp_argv .append (argv [0 ]);
1013
1027
try interp_argv .append ("--" );
1028
+ try interp_argv .append (argv [0 ]);
1014
1029
try interp_argv .appendSlice (argv [1.. ]);
1015
1030
} else {
1016
1031
return failForeign (run , "-fwasmtime" , argv [0 ], exe );
0 commit comments