Repository navigation
Commit d284022
authored
fix(uninstall): stop confirm prompt auto-abort on TTY (#5163)
<!-- markdownlint-disable MD041 -->
## Summary
Interactive `nemoclaw uninstall` printed `Proceed? [y/N]` and then
immediately `Aborted.` before the user could type — on every Linux TTY.
Regression from #5020, which replaced the child-shell stdin read with an
in-process `fs.readSync(0)` loop: `buildRuntime` touches `process.stdin`
to detect a TTY, which flips fd 0 to non-blocking (libuv side effect),
so the empty read throws `EAGAIN` and the catch treated it as EOF. This
PR detects the TTY without side effects, retries transient read errors,
and clarifies the abort message.
## Related Issue
<!-- Fixes #NNN or Closes #NNN. Remove this section if none. -->
Fixes #5188
## Changes
- Detect TTY via `tty.isatty(0)` in `buildRuntime` instead of
`process.stdin.isTTY`, which instantiates the stdin stream and switches
fd 0 to non-blocking mode for the rest of the process.
- Retry `EAGAIN`/`EWOULDBLOCK` (25 ms sleep) and `EINTR` in
`defaultReadLine` instead of conflating them with EOF; hard errors and
real EOF keep prior behavior (return buffered bytes or null).
- Print a `re-run with --yes` hint when stdin yields no input at the
confirm prompt instead of a bare `Aborted.`.
- Export `defaultReadLine` with injectable `readSync`/`sleep` deps; add
7 unit tests (EAGAIN retry, EINTR, EOF, CRLF, partial-line, hard errors)
and 1 integration test for the no-input message.
Manually verified under a pty against the compiled CLI: with fd 0
poisoned non-blocking, the prompt now waits for input (read `"y"` after
~1 s) instead of aborting in ~1 ms; full `internal uninstall run-plan`
waits and aborts only after an actual `n`.
## Type of Change
- [x] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)
## Verification
<!-- Check each item you ran and confirmed. Leave unchecked items you
skipped. Doc-only changes do not require npm test unless you ran it. -->
- [ ] `npx prek run --all-files` passes
- [ ] `npm test` passes
- [ ] Tests added or updated for new or changed behavior
- [ ] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `npm run docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)
---
<!-- DCO sign-off required by CI. Run: git config user.name && git
config user.email -->
Signed-off-by: Hung Le <[email protected]>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Improved uninstall confirmation behavior when stdin is
closed/non-interactive; now logs a clear message and guides rerunning
with --yes.
* Better terminal detection to avoid unwanted side effects and ensure
interactive prompts behave correctly.
* **Tests**
* Added robust tests covering no-stdin, TTY vs non-TTY, retry/error
cases, and PTY-driven prompt interactions to prevent regressions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent ea5c423 commit d284022
6 files changed
Lines changed: 503 additions & 26 deletions
File tree
- src/lib
- actions/uninstall
- core
- test
- fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
206 | 207 | | |
207 | 208 | | |
208 | 209 | | |
209 | | - | |
| 210 | + | |
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
| |||
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
244 | 292 | | |
245 | 293 | | |
246 | 294 | | |
| |||
580 | 628 | | |
581 | 629 | | |
582 | 630 | | |
583 | | - | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
584 | 639 | | |
585 | 640 | | |
586 | 641 | | |
| |||
664 | 719 | | |
665 | 720 | | |
666 | 721 | | |
667 | | - | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
668 | 726 | | |
669 | 727 | | |
670 | 728 | | |
| |||
735 | 793 | | |
736 | 794 | | |
737 | 795 | | |
738 | | - | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
739 | 801 | | |
740 | 802 | | |
741 | 803 | | |
| |||
763 | 825 | | |
764 | 826 | | |
765 | 827 | | |
766 | | - | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
767 | 833 | | |
768 | 834 | | |
769 | 835 | | |
| |||
799 | 865 | | |
800 | 866 | | |
801 | 867 | | |
| 868 | + | |
802 | 869 | | |
803 | 870 | | |
804 | 871 | | |
| |||
850 | 917 | | |
851 | 918 | | |
852 | 919 | | |
853 | | - | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
854 | 924 | | |
855 | 925 | | |
856 | 926 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | 96 | | |
113 | 97 | | |
114 | 98 | | |
| |||
254 | 238 | | |
255 | 239 | | |
256 | 240 | | |
257 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
258 | 244 | | |
259 | 245 | | |
260 | 246 | | |
| |||
266 | 252 | | |
267 | 253 | | |
268 | 254 | | |
269 | | - | |
| 255 | + | |
270 | 256 | | |
271 | 257 | | |
272 | 258 | | |
| |||
311 | 297 | | |
312 | 298 | | |
313 | 299 | | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
314 | 305 | | |
315 | 306 | | |
316 | 307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
0 commit comments