next-issue 6.6.87 → 6.6.88

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/dist/exec.mjs +16 -4
  2. package/package.json +1 -1
package/dist/exec.mjs CHANGED
@@ -7,6 +7,11 @@ let observer;
7
7
  const DEFAULT_TIMEOUT_MS = minutesToMs(10);
8
8
  const defaultTimeout = new AsyncLocalStorage();
9
9
  const STDERR_TAIL = 200_000;
10
+ // After the child exits, wait this long for `close`, which comes once both pipes have
11
+ // finished. A background process that inherited the pipes can keep them open, so `close`
12
+ // may never come. The fallback then waits one more poll phase before it closes the pipes,
13
+ // so output still in the pipes is read even when the event loop was busy past the wait.
14
+ const DRAIN_MS = 200;
10
15
  let shownCommands = 0;
11
16
  export function showingCommands() {
12
17
  return shownCommands > 0;
@@ -70,12 +75,14 @@ export function run(command, args, options = {}) {
70
75
  const output = collect(child, options);
71
76
  const timer = deadline(limit, () => killTree(child));
72
77
  let done = false;
78
+ let drain;
73
79
  let shown = options.show === true;
74
80
  if (shown) {
75
81
  shownCommands += 1;
76
82
  }
77
83
  const release = () => {
78
84
  timer.clear();
85
+ clearTimeout(drain);
79
86
  unwatch();
80
87
  if (shown) {
81
88
  shown = false;
@@ -98,12 +105,17 @@ export function run(command, args, options = {}) {
98
105
  reject(error);
99
106
  });
100
107
  child.on('exit', (code) => {
101
- if (!timer.timedOut()) {
108
+ const finish = () => {
109
+ child.stdout?.destroy();
110
+ child.stderr?.destroy();
111
+ settle(code);
112
+ };
113
+ if (timer.timedOut()) {
114
+ finish();
102
115
  return;
103
116
  }
104
- child.stdout?.destroy();
105
- child.stderr?.destroy();
106
- settle(code);
117
+ timer.clear();
118
+ drain = setTimeout(() => setImmediate(finish), DRAIN_MS);
107
119
  });
108
120
  child.on('close', settle);
109
121
  sendInput(child, options.input);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.87",
3
+ "version": "6.6.88",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",