Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add unstable exit-with-code function #44

Merged
merged 7 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ jobs:
git diff --exit-code
- uses: WebAssembly/wit-abi-up-to-date@v21
with:
worlds: "command imports"
wit-bindgen: '0.28.0'
worlds: 'command imports'
features: 'cli-exit-with-code'
11 changes: 11 additions & 0 deletions command.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ directory, interpreting <code>.</code> as shorthand for this.</p>
<ul>
<li><a name="exit.status"></a><code>status</code>: result</li>
</ul>
<h4><a name="exit_with_code"></a><code>exit-with-code: func</code></h4>
<p>Exit the current instance and any linked instances, reporting the
specified status code to the host.</p>
<p>The meaning of the code depends on the context, with 0 usually meaning
&quot;success&quot;, and other values indicating various types of failure.</p>
<p>This function does not return; the effect is analogous to a trap, but
without the connotation that something bad has happened.</p>
<h5>Params</h5>
<ul>
<li><a name="exit_with_code.status_code"></a><code>status-code</code>: <code>u8</code></li>
</ul>
<h2><a name="wasi_io_error_0_2_0"></a>Import interface wasi:io/error@0.2.0</h2>
<hr />
<h3>Types</h3>
Expand Down
11 changes: 11 additions & 0 deletions imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ directory, interpreting <code>.</code> as shorthand for this.</p>
<ul>
<li><a name="exit.status"></a><code>status</code>: result</li>
</ul>
<h4><a name="exit_with_code"></a><code>exit-with-code: func</code></h4>
<p>Exit the current instance and any linked instances, reporting the
specified status code to the host.</p>
<p>The meaning of the code depends on the context, with 0 usually meaning
&quot;success&quot;, and other values indicating various types of failure.</p>
<p>This function does not return; the effect is analogous to a trap, but
without the connotation that something bad has happened.</p>
<h5>Params</h5>
<ul>
<li><a name="exit_with_code.status_code"></a><code>status-code</code>: <code>u8</code></li>
</ul>
<h2><a name="wasi_io_error_0_2_0"></a>Import interface wasi:io/error@0.2.0</h2>
<hr />
<h3>Types</h3>
Expand Down
11 changes: 11 additions & 0 deletions wit/exit.wit
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,15 @@ interface exit {
/// Exit the current instance and any linked instances.
@since(version = 0.2.0)
exit: func(status: result);

/// Exit the current instance and any linked instances, reporting the
/// specified status code to the host.
dicej marked this conversation as resolved.
Show resolved Hide resolved
///
/// The meaning of the code depends on the context, with 0 usually meaning
/// "success", and other values indicating various types of failure.
///
/// This function does not return; the effect is analogous to a trap, but
/// without the connotation that something bad has happened.
@unstable(feature = cli-exit-with-code)
exit-with-code: func(status-code: u8);
}