2023-03-25 08:48:03 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Copyright 2023 The Go Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file.
|
|
|
|
|
2023-04-17 22:13:52 -07:00
|
|
|
case "$GOWASIRUNTIME" in
|
2023-05-09 20:32:19 -07:00
|
|
|
"wasmedge")
|
2023-05-08 17:07:18 +10:00
|
|
|
exec wasmedge --dir=/ --env PWD="$PWD" ${GOWASIRUNTIMEARGS:-} "$1" "${@:2}"
|
2023-05-09 20:32:19 -07:00
|
|
|
;;
|
2023-05-08 22:21:19 -07:00
|
|
|
"wasmer")
|
2023-05-08 17:07:18 +10:00
|
|
|
exec wasmer run --dir=/ --env PWD="$PWD" ${GOWASIRUNTIMEARGS:-} "$1" -- "${@:2}"
|
2023-05-08 22:21:19 -07:00
|
|
|
;;
|
2023-04-17 22:13:52 -07:00
|
|
|
"wasmtime")
|
|
|
|
exec wasmtime run --dir=/ --env PWD="$PWD" --max-wasm-stack 1048576 "$1" -- "${@:2}"
|
|
|
|
;;
|
|
|
|
"wazero" | "")
|
2023-04-26 15:54:28 -04:00
|
|
|
exec wazero run -mount /:/ -env-inherit -cachedir "${TMPDIR:-/tmp}"/wazero "$1" "${@:2}"
|
2023-04-17 22:13:52 -07:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown Go WASI runtime specified: $GOWASIRUNTIME"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|