Skip to content

Commit

Permalink
solve ordering of stdin, stdout, stderr.
Browse files Browse the repository at this point in the history
  • Loading branch information
SirJosh3917 authored and SirJosh3917 committed May 11, 2021
1 parent c7a287c commit 7a71315
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion design/file-descriptors.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
File Descriptors ([witx type `fd`](https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/docs.md#-fd)), often referred to as "handles" interchangeably, are an abstract way of representing access to a resource. More often than not, they are processes (WIP), sockets (WIP), files, or even the console.

## The Console
When a program is initiated, `stdout`, `stdin`, and `stderr` (respectively `fd` ids `0`, `1`, and `2`) are opened. To print to these, simply call `fd_write` with the corresponding arguments. An simple "Hello World!" program written in `wat` is shown below, [sourced from the wasmtime test suite](https://github.com/bytecodealliance/wasmtime/blob/main/tests/wasm/hello_wasi_snapshot1.wat):
When a program is initiated, `stdin`, `stdout`, and `stderr` (respectively `fd` ids `0`, `1`, and `2`) are opened. To print to these, simply call `fd_write` with the corresponding arguments. An simple "Hello World!" program written in `wat` is shown below, [sourced from the wasmtime test suite](https://github.com/bytecodealliance/wasmtime/blob/main/tests/wasm/hello_wasi_snapshot1.wat):

```wat
(module
Expand Down

0 comments on commit 7a71315

Please sign in to comment.