Add function and example program detecting WASI runability (#250)

This commit is contained in:
Félix Saparelli 2022-07-26 23:28:17 +12:00 committed by GitHub
parent 900186e57d
commit 9d99bfb81f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 0 deletions

13
examples/detect-wasi.rs Normal file
View file

@ -0,0 +1,13 @@
use std::process::exit;
use cargo_binstall::wasi::detect_wasi_runability;
fn main() {
if detect_wasi_runability().unwrap() {
println!("WASI is runnable!");
exit(0);
} else {
println!("WASI is not runnable");
exit(1);
}
}