]> Cypherpunks.ru repositories - gostls13.git/blob - misc/wasm/go_wasip1_wasm_exec
misc/wasm: add wasmer to wasip1 script
[gostls13.git] / misc / wasm / go_wasip1_wasm_exec
1 #!/usr/bin/env bash
2 # Copyright 2023 The Go Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style
4 # license that can be found in the LICENSE file.
5
6 case "$GOWASIRUNTIME" in
7         "wasmer")
8                 exec wasmer run --dir=/ --env PWD="$PWD" "$1" -- "${@:2}"
9                 ;;
10         "wasmtime")
11                 exec wasmtime run --dir=/ --env PWD="$PWD" --max-wasm-stack 1048576 "$1" -- "${@:2}"
12                 ;;
13         "wazero" | "")
14                 exec wazero run -mount /:/ -env-inherit -cachedir "${TMPDIR:-/tmp}"/wazero "$1" "${@:2}"
15                 ;;
16         *)
17                 echo "Unknown Go WASI runtime specified: $GOWASIRUNTIME"
18                 exit 1
19                 ;;
20 esac