cherrypick-interactive 1.14.3 → 1.14.5
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.
- package/cli.js +5 -0
- package/package.json +1 -1
- package/src/tui/index.js +18 -9
package/cli.js
CHANGED
|
@@ -1621,6 +1621,11 @@ async function main() {
|
|
|
1621
1621
|
await deleteSession();
|
|
1622
1622
|
|
|
1623
1623
|
log(chalk.green(`\n✅ Done on ${finalBranch}`));
|
|
1624
|
+
|
|
1625
|
+
// Allow process to exit naturally. stdin.ref() may have been called
|
|
1626
|
+
// after ink unmount to keep inquirer prompts working; unref it now
|
|
1627
|
+
// so the event loop can drain.
|
|
1628
|
+
process.stdin.unref();
|
|
1624
1629
|
} catch (e) {
|
|
1625
1630
|
err(chalk.red(`\n❌ Error: ${e.message || e}`));
|
|
1626
1631
|
|
package/package.json
CHANGED
package/src/tui/index.js
CHANGED
|
@@ -2,6 +2,22 @@ import { render } from 'ink';
|
|
|
2
2
|
import { createElement } from 'react';
|
|
3
3
|
import { App } from './App.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Restore process.stdin after ink unmount.
|
|
7
|
+
* Ink sets stdin.setRawMode(false) and stdin.unref() on cleanup (App.js),
|
|
8
|
+
* which causes subsequent inquirer prompts to immediately throw
|
|
9
|
+
* ExitPromptError ("Aborted by user") because the event loop stops
|
|
10
|
+
* waiting for stdin input.
|
|
11
|
+
*/
|
|
12
|
+
function restoreStdin() {
|
|
13
|
+
const { stdin } = process;
|
|
14
|
+
if (typeof stdin.setRawMode === 'function') {
|
|
15
|
+
stdin.setRawMode(false);
|
|
16
|
+
}
|
|
17
|
+
stdin.resume();
|
|
18
|
+
stdin.ref();
|
|
19
|
+
}
|
|
20
|
+
|
|
5
21
|
/**
|
|
6
22
|
* Render the TUI commit selector.
|
|
7
23
|
* @param {Array<{hash: string, subject: string}>} commits
|
|
@@ -33,18 +49,11 @@ export function renderCommitSelector(commits, gitRawFn, { devBranch, mainBranch,
|
|
|
33
49
|
);
|
|
34
50
|
|
|
35
51
|
waitUntilExit().then(() => {
|
|
36
|
-
|
|
37
|
-
// Ink pauses stdin on unmount which causes inquirer to immediately
|
|
38
|
-
// throw ExitPromptError ("Aborted by user").
|
|
39
|
-
if (process.stdin.isPaused()) {
|
|
40
|
-
process.stdin.resume();
|
|
41
|
-
}
|
|
52
|
+
restoreStdin();
|
|
42
53
|
// Fallback: if exited without calling onDone, resolve with empty
|
|
43
54
|
settle([]);
|
|
44
55
|
}).catch(() => {
|
|
45
|
-
|
|
46
|
-
process.stdin.resume();
|
|
47
|
-
}
|
|
56
|
+
restoreStdin();
|
|
48
57
|
settle([]);
|
|
49
58
|
});
|
|
50
59
|
});
|