Skip to content

Instantly share code, notes, and snippets.

@isurfer21
Created July 1, 2023 18:05
Show Gist options
  • Save isurfer21/7199f72346f6cddf83773a9457c716fa to your computer and use it in GitHub Desktop.
Save isurfer21/7199f72346f6cddf83773a9457c716fa to your computer and use it in GitHub Desktop.
Download the latest wasi-sdk from https://github.com/WebAssembly/wasi-sdk/releases, extract it somewhere, create environment variable with WASI_SDK_PATH name and store the path of extracted wasi-sdk. Copy the wasi.cmd & wasi.ps1 files from given gist and paste it somewhere globally accessible. Now you can can access the wasi-sdk's executables vi…
@echo off
setlocal
set wasi_bin_path=%WASI_SDK_PATH%\bin
set wasi_self=%~n0
set wasi_cmd=%1
if "%wasi_cmd%" == "" (
echo Usage: %wasi_self% executable [arguments]
exit /b 1
)
if not exist "%wasi_bin_path%\%wasi_cmd%.exe" (
echo Error: %wasi_cmd% is not a valid executable in %wasi_bin_path%
exit /b 2
)
shift
%wasi_bin_path%\%*
#!/usr/bin/env pwsh
$wasi_bin_path = "$env:WASI_SDK_PATH\bin"
$wasi_self = $MyInvocation.MyCommand.Name
$wasi_cmd = $args[0]
if ($args.Length -eq 0) {
Write-Host "Usage: $wasi_self executable [arguments]"
exit 1
}
if (-not (Test-Path "$wasi_bin_path\$wasi_cmd.exe")) {
Write-Host "Error: $wasi_cmd is not a valid executable in $wasi_bin_path"
exit 2
}
$args = $args[1..($args.Length - 1)]
& "$wasi_bin_path\$wasi_cmd.exe" $args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment