wstd::main doesn't set exit code on failure
メンテナーはふだん 5 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
まず #[wstd::main] の実装を見つけ、Result エラーが wasi-run WIT インターフェースをどのように通過するかを追跡します。issue で説明されている tokio::main パターンとその動作を比較します。失敗した async main がゼロ以外の終了コードを返し、エラーを黙って破棄しなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
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]
async fn main() -> Result<(), Box<dyn Error>> {
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};
fn main() {
wstd::runtime::block_on(async move {
if let Err(err) = async_main().await {
eprintln!("{err}");
std::process::exit(1);
}
});
}
async fn async_main() -> Result<(), Box<dyn Error>> {
let request = Request::get("https://non-existing-url.example.com").body(Body::empty())?;
let _response = Client::new().send(request).await?;
Ok(())
}
- 主要言語
- Rust
- スター
- 136
- フォーク
- 21
- 平均マージ
- 5日 6時間
- マージ済み PR(30日)
- 11
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bytecodealliance/wstd のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
bytecodealliance/wstd#166 ·
メンテナーはふだん 5 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
bytecodealliance/wstd#164 ·
メンテナーはふだん 5 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
bytecodealliance/wstd#161 ·
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
bytecodealliance/wstd#151 ·
メンテナーはふだん 5 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 32/100
bytecodealliance/wstd#141 · コメント 6 件 · リアクション 1 件 ·
メンテナーはふだん 5 日以内に返信
bytecodealliance/wstd の issue をすべて見る
似ている issue
-
review-drift
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
oxidecomputer/hansei#14 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
rubys/roundhouse#444 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
install: root SSH tmpfiles.d drop-in is labeled etc_runtime_t instead of etc_t対応中かも @andrewdunndev が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信