Skip to content

Commit bc9d443

Browse files
committed
review: feature-gate and update maybe_exit_on_error documentation
1 parent 3005167 commit bc9d443

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ wasmtime-cli-flags = { workspace = true }
2828
wasmtime-cranelift = { workspace = true }
2929
wasmtime-environ = { workspace = true }
3030
wasmtime-wast = { workspace = true }
31-
wasmtime-wasi = { workspace = true }
31+
wasmtime-wasi = { workspace = true, features = ["exit"] }
3232
wasmtime-wasi-crypto = { workspace = true, optional = true }
3333
wasmtime-wasi-nn = { workspace = true, optional = true }
3434
wasmtime-wasi-threads = { workspace = true, optional = true }

crates/wasi-threads/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ log = { workspace = true }
1717
rand = "0.8"
1818
wasi-common = { workspace = true }
1919
wasmtime = { workspace = true }
20-
wasmtime-wasi = { workspace = true }
20+
wasmtime-wasi = { workspace = true, features = ["exit"] }
2121

2222
[badges]
2323
maintenance = { status = "experimental" }

crates/wasi/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ anyhow = { workspace = true }
2525
default = ["sync"]
2626
sync = ["wasi-cap-std-sync"]
2727
tokio = ["wasi-tokio", "wasmtime/async", "wiggle/wasmtime_async"]
28+
exit = []

crates/wasi/src/lib.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ pub mod snapshots {
8787
/// understands the error. If the error is not an `I32Exit` or `Trap`, return
8888
/// the error back to the caller for it to decide what to do.
8989
///
90-
/// Note: this function is designed for CLI usage of Wasmtime; embedders of
91-
/// Wasmtime may want different error handling.
90+
/// Note: this function is designed for usage where it is acceptable for
91+
/// Wasmtime failures to terminate the parent process, such as in the Wasmtime
92+
/// CLI; this would not be suitable for use in multi-tenant embeddings.
93+
#[cfg(feature = "exit")]
9294
pub fn maybe_exit_on_error(e: anyhow::Error) -> anyhow::Error {
9395
use std::process;
9496
use wasmtime::Trap;

0 commit comments

Comments
 (0)