-
Notifications
You must be signed in to change notification settings - Fork 799
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2059: fix(wasi) Fix the logic behind inherited/captured `stdin`, `stdout` and `stderr` r=Hywan a=Hywan # Description This patch is both a fix and a feature! First, let's no longer derive from `Default` for `wasi_config_t`. By default, we want to inherit `stdin`, `stdout` and `stderr`. The default for `bool` is `false`; we want `true` here. Second, let's update `wasi_config_new` to correctly set `inherit_*` fields to `true`. Third, lets' create `wasi_config_capture_*` functions. By default, `std*` are inherited, so we need functions to capture them. That's the new feature this patch introduces. The `wasi_config_inherit_*` functions are kept for the sake of backward compatibility. Ideally, we would want an API like `wasi_config_capture_*(capture: bool)`, but it would duplicate the API somehow. Fourth, let's fix `wasi_env_new`. We want to capture `stdout` and `stderr` if and only if the `inherit_*` fields are set to `false`. There was bug here. That's why everything was working correctly by the way: `bool::default()` is `false`, and we have this inverted condition here, so everything was working as expected because of a double error. The only bug was that it wasn't possible to capture `std*` before. # Review - [x] Add a short description of the the change to the CHANGELOG.md file Co-authored-by: Ivan Enderlin <ivan@mnt.io>
- Loading branch information
Showing
4 changed files
with
41 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters