Commit 369fedf
fix: ignore stray empty input in interactive prompts
When running interactive tests (like `INTERACTIVE=1 cargo test --nocapture`),
stray newlines from previous commands or input streams can cause `read_line`
to immediately return an empty string. This caused the first prompt
(`prompt_microstructure_variable`) to be skipped, and the intended
answer was instead consumed by the second prompt (`prompt_cutoff_value`).
This commit updates `helpers::prompt_microstructure_variable` and
`helpers::prompt_cutoff_value` to repeatedly read from `stdin` until a
non-empty line is provided. It also correctly handles EOF (`bytes == 0`)
to prevent infinite loops when stdin is exhausted.
Co-authored-by: soniapi <396009+soniapi@users.noreply.github.com>1 parent ad47dfb commit 369fedf
1 file changed
Lines changed: 28 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
17 | 28 | | |
18 | 29 | | |
19 | 30 | | |
| |||
52 | 63 | | |
53 | 64 | | |
54 | 65 | | |
55 | | - | |
56 | | - | |
57 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
58 | 80 | | |
59 | 81 | | |
60 | 82 | | |
| |||
0 commit comments