aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorRandy Reddig <[email protected]>2023-11-02 11:49:52 -0700
committerGitHub <[email protected]>2023-11-02 19:49:52 +0100
commit174d49235552381552c34bbe4a98d0a2ff6f046f (patch)
tree8c0329bb24703e2ce4e6f7157db66584c5b938a6 /main.go
parent5355473dce94dd6112968ec2684ae2c5c077fa9a (diff)
downloadtinygo-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.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/main.go b/main.go
index 72bf76a11..f9eb4eff4 100644
--- a/main.go
+++ b/main.go
@@ -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