iterate-harness 2.2.7 → 2.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/ui.js +15 -1
  2. package/package.json +1 -1
package/lib/ui.js CHANGED
@@ -110,7 +110,21 @@ function askYesNo(question, defaultNo = false, options = {}) {
110
110
  );
111
111
  finish(defaultNo);
112
112
  }, timeoutMs);
113
- if (typeof timer.unref === "function") timer.unref();
113
+ // Only unref the timer when the real terminal is in play. A TTY or
114
+ // piped stdin keeps the event loop alive through its OS file descriptor,
115
+ // so the unref'd timeout cannot be dropped before it fires (and it never
116
+ // blocks process exit once the prompt has settled). Injected streams
117
+ // (tests, embedded hosts) hold NO descriptor, so an unref'd timer can be
118
+ // skipped on an otherwise-empty loop — leaving the call pending forever
119
+ // instead of settling on the default. Keep the timer referenced there so
120
+ // the bounded-wait guarantee actually holds.
121
+ if (
122
+ typeof timer.unref === "function" &&
123
+ input === process.stdin &&
124
+ Boolean(input.isTTY)
125
+ ) {
126
+ timer.unref();
127
+ }
114
128
  }
115
129
  const hint = defaultNo ? "[y/N]" : "[Y/n]";
116
130
  rl.question(`\x1b[36m◆\x1b[0m ${question} ${hint} `, (answer) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iterate-harness",
3
- "version": "2.2.7",
3
+ "version": "2.2.8",
4
4
  "description": "npm distribution wrapper for iterate-harness — installs the Python harness (ih CLI) into a managed venv on install and exposes it as a global command",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",