Repository navigation
Commit b940993
committed
admin: share stdin reader across password prompts
readPassword created a fresh bufio.Reader on every call. bufio reads
ahead into its buffer, so the first prompt consumed the password line
and buffered the confirmation line, which was then discarded with the
reader. The second prompt built a new reader on an already-drained pipe
and failed with EOF.
This stayed hidden as long as the two lines arrived far enough apart
that only the first was available at the initial read. Any startup delay
that let both lines queue up first exposed it.
Keep a single package-level reader so buffered read-ahead survives
between prompts.
Signed-off-by: Robin Jarry <robin@jarry.cc>1 parent 67beeaa commit b940993
2 files changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
216 | 221 | | |
217 | 222 | | |
218 | 223 | | |
219 | 224 | | |
220 | 225 | | |
221 | 226 | | |
222 | 227 | | |
223 | | - | |
224 | | - | |
| 228 | + | |
225 | 229 | | |
226 | 230 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
187 | 186 | | |
188 | 187 | | |
189 | 188 | | |
| |||
0 commit comments