Errata

Command-Line Rust

Errata for Command-Line Rust

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Page Chapter 1 - Understanding Program Exit Values
Locarion 709 of 19798

```rust
#[test]
fn false_not_ok() {
let mut cmd = Command::cargo_bin("false").unwrap();
cmd.assert().failure();
}
```
This test fails

Note from the Author or Editor:
I cannot see how this test fails for you. It definitely works for me. Are you sure that your "false" program is correctly reporting a nonzero exit value?

Anonymous  Jun 17, 2023 
PDF Page 57
2nd paragraph

"Both a filehandle and std::io::stdin implement the BufRead trait"

In fact, filehandle and std::io::stdin only implement the Read trait.

A BufReader is created subsequently which is implemented for the Read trait. BufReader in turn implements the BufRead trait which provides the BufRead::lines method.

Carsten Klaucke  Mar 10, 2024 
ePub Page 109
3rd block of text, starting with "I want to highlight"

This sentence:

> I want to highlight how I create a temporary list using a slice with all the flags.

refers to this code:

> [args.words, args.bytes, args.chars, args.lines]

From what I can tell this is an array, not a slice. By attempting to call a non-existent method on it I get an error like this one:

no method named `taco` found for array `[bool; 4]` in the current scope
method not found in `[bool; 4]`

Anonymous  May 31, 2024 
ePub Page 173 (2024 release)
Setting up the delimiter argument

The long flag name for delimiter is incorrectly written as "delim" and should instead be "delimiter".

As listed in the book:

.arg(
Arg::new("delimiter")
.value_name("DELIMITER")
.short('d')
.long("delim")
.help("Field delimiter")
.default_value("\t"),
)

It should instead be:

.arg(
Arg::new("delimiter")
.value_name("DELIMITER")
.short('d')
.long("delimiter")
.help("Field delimiter")
.default_value("\t"),
)

Anonymous  Jun 19, 2024