Skip to content

Commit

Permalink
Ensure scripts are runnable on Windows (use which('bash'))
Browse files Browse the repository at this point in the history
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
  • Loading branch information
evacchi committed Jan 26, 2023
1 parent 4dab0f7 commit d0a5099
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test-runner/wasi_test_runner/runtime_adapter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import subprocess
from shutil import which
from pathlib import Path
from typing import Dict, NamedTuple, List

Expand All @@ -13,10 +14,14 @@ class RuntimeVersion(NamedTuple):
class RuntimeAdapter:
def __init__(self, adapter_path: str) -> None:
self._adapter_path = self._abs(adapter_path)
# invoke the adapter with a configured shell runner. Default to bash.
# e.g. this is needed to point GHA's Windows runner to bash executable
self._shell = which('bash')

def get_version(self) -> RuntimeVersion:
output = (
subprocess.check_output([self._adapter_path, "--version"], encoding="UTF-8")
# use the configured shell binary
subprocess.check_output([self._shell, self._adapter_path, "--version"], encoding="UTF-8")
.strip()
.split(" ")
)
Expand All @@ -31,6 +36,8 @@ def run_test(
) -> Output:
args = (
[
# use the configured shell binary
self._shell,
self._adapter_path,
"--test-file",
self._abs(test_path),
Expand Down

0 comments on commit d0a5099

Please sign in to comment.