Skip to content

Commit a68c679

Browse files
authored
FIXUP
1 parent 8663548 commit a68c679

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

examples/wasi-hello-world/wasi-hello-world.rust.en-us.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn main() {
3636
// This code requires the Wasi host to provide a `/helloworld` directory on the guest.
3737
// If the `/helloworld` directory is not available, the unwrap() will cause this program to panic.
3838
// For example, in Wasmtime, if you want to map the current directory to `/helloworld`,
39-
// invoke the runtime with the flag/argument: `--mapdir /helloworld::.`
39+
// invoke the runtime with the flag/argument: `--dir /helloworld::.`
4040
// This will map the `/helloworld` directory on the guest, to the current directory (`.`) on the host
4141
let mut file = fs::File::create("/helloworld/helloworld.txt").unwrap();
4242

@@ -58,16 +58,16 @@ Our wasm file should be compiled to `target/wasm32-wasi/debug/wasi_hello_world.w
5858

5959
To do this, we can use the Wasmtime CLI, which we mentioned should be installed at the beginning of this tutorial. However, there is one thing to note that was mentioned in the code comments. **We need to give our program explicit access to create files on our host, because our program creates a new file**. As mentioned in the [WASI Introduction](/example-redirect?exampleName=wasi-introduction), our guest will not have this capability unless we give them the capability.
6060

61-
To grant the capability to write in a directory using the Wasmtime CLI, we need to use the `--mapdir` flag. `--mapdir` will allow us to map the `/helloworld` directory on the guest's virtual filesystem, to the current directory (`.`) on the host fileystem. For example:
61+
To grant the capability to write in a directory using the Wasmtime CLI, we need to use the `--dir` flag. `--dir` will allow us to map the `/helloworld` directory on the guest's virtual filesystem, to the current directory (`.`) on the host fileystem. For example:
6262

6363
```bash
64-
wasmtime --mapdir GUEST_DIRECTORY::HOST_DIRECTORY my-wasi-program.wasm
64+
wasmtime --dir GUEST_DIRECTORY::HOST_DIRECTORY my-wasi-program.wasm
6565
```
6666

6767
So, **to run our compiled WASI program, we will run**:
6868

6969
```bash
70-
wasmtime --mapdir /helloworld::. target/wasm32-wasi/debug/wasi_hello_world.wasm
70+
wasmtime --dir /helloworld::. target/wasm32-wasi/debug/wasi_hello_world.wasm
7171
```
7272

7373
You should then see "Hello World!" logged in your terminal. You should also notice that a `helloworld.txt` file was created in your current directory, with the contents of "Hello World!".

examples/wasi-hello-world/wasi-hello-world.rust.pt-br.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn main() {
3636
// This code requires the Wasi host to provide a `/helloworld` directory on the guest.
3737
// If the `/helloworld` directory is not available, the unwrap() will cause this program to panic.
3838
// For example, in Wasmtime, if you want to map the current directory to `/helloworld`,
39-
// invoke the runtime with the flag/argument: `--mapdir /helloworld::.`
39+
// invoke the runtime with the flag/argument: `--dir /helloworld::.`
4040
// This will map the `/helloworld` directory on the guest, to the current directory (`.`) on the host
4141
let mut file = fs::File::create("/helloworld/helloworld.txt").unwrap();
4242

@@ -58,16 +58,16 @@ O nosso arquivo wasm deveria ser compilado a `target/wasm32-wasi/debug/wasi_hell
5858

5959
Para isso, podemos usar a linha de comando do Wasmtime, que lhe pedimos para instalar no início deste tutorial. No entanto, há uma coisa a notar que foi mencionada nos comentários do programa. **Precisamos explicitamente dar ao nosso programa acesso à criação de arquivos no nosso host, pois o nosso programa cria um novo arquivo**. Como mencionado na [Introdução à WASI](/example-redirect?exampleName=wasi-introduction), o nosso guest não tem essa capacidade a menos que nós lhe demos tal capacidade.
6060

61-
Para autorizar o uso da capacidade de escrever em um diretório usando a linha de comando do Wasmtime, precisamos passar o parâmetro `--mapdir`. `--mapdir` nos permite mapear o diretório `/helloworld` no sistema de arquivos virtual do guest, ao diretório atual (`.`) no sistema de arquivos do host. Por exemplo:
61+
Para autorizar o uso da capacidade de escrever em um diretório usando a linha de comando do Wasmtime, precisamos passar o parâmetro `--dir`. `--dir` nos permite mapear o diretório `/helloworld` no sistema de arquivos virtual do guest, ao diretório atual (`.`) no sistema de arquivos do host. Por exemplo:
6262

6363
```bash
64-
wasmtime --mapdir GUEST_DIRECTORY::HOST_DIRECTORY my-wasi-program.wasm
64+
wasmtime --dir GUEST_DIRECTORY::HOST_DIRECTORY my-wasi-program.wasm
6565
```
6666

6767
E assim, **para rodar o nosso programa WASI compilado, executamos**:
6868

6969
```bash
70-
wasmtime --mapdir /helloworld::. target/wasm32-wasi/debug/wasi_hello_world.wasm
70+
wasmtime --dir /helloworld::. target/wasm32-wasi/debug/wasi_hello_world.wasm
7171
```
7272

7373
Você deve então ver "Hello World!" escrito na tela do seu terminal. E também deve notar que um novo arquivo `helloworld.txt` apareceu no seu diretório atual, com o conteúdo "Hello World!".

0 commit comments

Comments
 (0)