diff options
author | Randy Reddig <[email protected]> | 2023-11-02 11:49:52 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2023-11-02 19:49:52 +0100 |
commit | 174d49235552381552c34bbe4a98d0a2ff6f046f (patch) | |
tree | 8c0329bb24703e2ce4e6f7157db66584c5b938a6 /main.go | |
parent | 5355473dce94dd6112968ec2684ae2c5c077fa9a (diff) | |
download | tinygo-174d49235552381552c34bbe4a98d0a2ff6f046f.tar.gz tinygo-174d49235552381552c34bbe4a98d0a2ff6f046f.zip |
compileopts, targets, main: support Wasmtime v14 (#3972)
compileopts, targets, main: support Wasmtime v14
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -797,7 +797,7 @@ func buildAndRun(pkgName string, config *compileopts.Config, stdout io.Writer, c needsEnvInVars = true } } - var args, env []string + var args, emuArgs, env []string var extraCmdEnv []string if needsEnvInVars { runtimeGlobals := make(map[string]string) @@ -820,13 +820,14 @@ func buildAndRun(pkgName string, config *compileopts.Config, stdout io.Writer, c } else if config.EmulatorName() == "wasmtime" { // Wasmtime needs some special flags to pass environment variables // and allow reading from the current directory. - args = append(args, "--dir=.") + emuArgs = append(emuArgs, "--dir=.") for _, v := range environmentVars { - args = append(args, "--env", v) + emuArgs = append(emuArgs, "--env", v) } if len(cmdArgs) != 0 { - // mark end of wasmtime arguments and start of program ones: -- - args = append(args, "--") + // Use of '--' argument no longer necessary as of Wasmtime v14: + // https://github.com/bytecodealliance/wasmtime/pull/6946 + // args = append(args, "--") args = append(args, cmdArgs...) } @@ -876,7 +877,7 @@ func buildAndRun(pkgName string, config *compileopts.Config, stdout io.Writer, c return result, err } name = emulator[0] - emuArgs := append([]string(nil), emulator[1:]...) + emuArgs = append(emuArgs, emulator[1:]...) args = append(emuArgs, args...) } var cmd *exec.Cmd |