]> Cypherpunks.ru repositories - gostls13.git/blob - misc/wasm/go_wasip1_wasm_exec
misc/wasm: default to /tmp if TMPDIR is unset
[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         "wasmtime")
8                 exec wasmtime run --dir=/ --env PWD="$PWD" --max-wasm-stack 1048576 "$1" -- "${@:2}"
9                 ;;
10         "wazero" | "")
11                 exec wazero run -mount /:/ -env-inherit -cachedir "${TMPDIR:-/tmp}"/wazero "$1" "${@:2}"
12                 ;;
13         *)
14                 echo "Unknown Go WASI runtime specified: $GOWASIRUNTIME"
15                 exit 1
16                 ;;
17 esac