When using the #[wstd::main] i would expect that an error would set another exitcode than 0.
This beavior is the same right now as tokio::main in a none wasm-application.
Example usage:
use std::error::Error;use wstd::http::{Body,Client,Request};#[wstd::main]asyncfnmain() -> Result<(),Box<dynError>>{let request = Request::get("https://non-existing-url.example.com").body(Body::empty())?;let _response = Client::new().send(request).await?;Ok(())}This will return Exit-code 0 when compiled to wasip2 through the wasi-run WIT-interface, and the error form the application will be throwed away between the wit-interface.
Is this the intended behavior?
For example right now i have to do this to make my "main" applications async
use std::error::Error;use wstd::http::{Body,Client,Request};fnmain(){
wstd::runtime::block_on(asyncmove{ifletErr(err) = async_main().await{eprintln!("{err}");
std::process::exit(1);}});}asyncfnasync_main() -> Result<(),Box<dynError>>{let request = Request::get("https://non-existing-url.example.com").body(Body::empty())?;let _response = Client::new().send(request).await?;Ok(())}
When using the
#[wstd::main]i would expect that an error would set another exitcode than 0.This beavior is the same right now as tokio::main in a none wasm-application.
Example usage:
This will return Exit-code 0 when compiled to wasip2 through the wasi-run WIT-interface, and the error form the application will be throwed away between the wit-interface.
Is this the intended behavior?
For example right now i have to do this to make my "main" applications async