Fix code in WASI-tutorial.md
This commit is contained in:
@@ -121,14 +121,14 @@ use std::io::{Read, Write};
|
||||
|
||||
fn process(input_fname: &str, output_fname: &str) -> Result<(), String> {
|
||||
let mut input_file =
|
||||
fs::File::open(input_fname).map_err(|err| format!("error opening input: {}", err))?;
|
||||
fs::File::open(input_fname).map_err(|err| format!("error opening input {}: {}", input_fname, err))?;
|
||||
let mut contents = Vec::new();
|
||||
input_file
|
||||
.read_to_end(&mut contents)
|
||||
.map_err(|err| format!("read error: {}", err))?;
|
||||
|
||||
let mut output_file = fs::File::create(output_fname)
|
||||
.map_err(|err| format!("error opening output '{}': {}", output_fname, err))?;
|
||||
.map_err(|err| format!("error opening output {}: {}", output_fname, err))?;
|
||||
output_file
|
||||
.write_all(&contents)
|
||||
.map_err(|err| format!("write error: {}", err))
|
||||
@@ -139,7 +139,7 @@ fn main() {
|
||||
let program = args[0].clone();
|
||||
|
||||
if args.len() < 3 {
|
||||
eprintln!("{} <input_file> <output_file>", program);
|
||||
eprintln!("usage: {} <input_file> <output_file>", program);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user