| 1 | #!/bin/bash |
| 2 | # |
| 3 | # Wrapper script for go_js_wasm_exec to be executable by go test -exec. |
| 4 | # |
| 5 | # Prefers the Go toolchain's bundled Node.js launcher over any other |
| 6 | # go_js_wasm_exec that may be present in PATH (e.g. wasmbrowsertest), |
| 7 | # which ensures CI runs tests in Node.js rather than a headless browser. |
| 8 | # |
| 9 | |
| 10 | set -e |
| 11 | |
| 12 | GOROOT=$(go env GOROOT) |
| 13 | for candidate in \ |
| 14 | "${GOROOT}/lib/wasm/go_js_wasm_exec" \ |
| 15 | "${GOROOT}/misc/wasm/go_js_wasm_exec"; do |
| 16 | if [ -x "${candidate}" ]; then |
| 17 | exec "${candidate}" "$@" |
| 18 | fi |
| 19 | done |
| 20 | |
| 21 | echo "jswasm-wrapper: could not find go_js_wasm_exec in GOROOT/lib/wasm or GOROOT/misc/wasm" >&2 |
| 22 | exit 1 |