gestalt-mobile 0.68.6 → 0.68.7
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.
|
@@ -127,20 +127,36 @@ export async function probeKimiVersion() {
|
|
|
127
127
|
}
|
|
128
128
|
export function installShutdownHandlers(app, signalSource = process) {
|
|
129
129
|
let closing;
|
|
130
|
+
let signalled = false;
|
|
130
131
|
const shutdown = () => {
|
|
131
|
-
closing ??=
|
|
132
|
+
closing ??= Promise.resolve()
|
|
133
|
+
.then(() => app.close())
|
|
134
|
+
.finally(() => {
|
|
135
|
+
signalSource.removeListener('SIGINT', onInterrupt);
|
|
136
|
+
signalSource.removeListener('SIGTERM', onTerminate);
|
|
137
|
+
});
|
|
132
138
|
return closing;
|
|
133
139
|
};
|
|
134
140
|
const onSignal = () => {
|
|
135
|
-
|
|
136
|
-
|
|
141
|
+
if (signalled)
|
|
142
|
+
return;
|
|
143
|
+
signalled = true;
|
|
137
144
|
void shutdown().catch((error) => {
|
|
138
145
|
process.exitCode = 1;
|
|
139
146
|
console.error(error instanceof Error ? error.message : 'Shutdown failed');
|
|
140
147
|
});
|
|
141
148
|
};
|
|
142
|
-
|
|
143
|
-
|
|
149
|
+
// Keep intercepting repeated console interrupts until graceful cleanup settles.
|
|
150
|
+
const onInterrupt = () => {
|
|
151
|
+
signalSource.once('SIGINT', onInterrupt);
|
|
152
|
+
onSignal();
|
|
153
|
+
};
|
|
154
|
+
const onTerminate = () => {
|
|
155
|
+
signalSource.once('SIGTERM', onTerminate);
|
|
156
|
+
onSignal();
|
|
157
|
+
};
|
|
158
|
+
signalSource.once('SIGINT', onInterrupt);
|
|
159
|
+
signalSource.once('SIGTERM', onTerminate);
|
|
144
160
|
return shutdown;
|
|
145
161
|
}
|
|
146
162
|
function parseInvocation(args, cwd) {
|
|
@@ -265,13 +265,21 @@ export class LocalHostTestRunner {
|
|
|
265
265
|
Object.assign(env, scratchEnvironment);
|
|
266
266
|
let child;
|
|
267
267
|
try {
|
|
268
|
-
child = spawn(process.execPath, ['-
|
|
268
|
+
child = spawn(process.execPath, ['--input-type=commonjs', '-', 'gestalt-host-tests'], {
|
|
269
269
|
cwd: suite.repository,
|
|
270
270
|
env,
|
|
271
271
|
detached: true,
|
|
272
272
|
shell: false,
|
|
273
|
-
stdio: ['pipe', 'pipe', 'pipe', 'ipc'],
|
|
273
|
+
stdio: ['pipe', 'pipe', 'pipe', 'ipc', 'pipe'],
|
|
274
274
|
});
|
|
275
|
+
// Source and invocation details use the source pipe; fd 4 stays open as
|
|
276
|
+
// the independent host lifetime pipe until cleanup is requested.
|
|
277
|
+
const source = child.stdin;
|
|
278
|
+
child.stdin = child.stdio[4];
|
|
279
|
+
source.on('error', () => { });
|
|
280
|
+
source.end(`process.argv = [process.execPath, ...${JSON.stringify([suite.command, JSON.stringify(suite.args), suite.repository])}];\n` +
|
|
281
|
+
`Object.defineProperty(process,'stdin',{value:new (require('node:net').Socket)({fd:4,readable:true,writable:false})});\n` +
|
|
282
|
+
guardian);
|
|
275
283
|
}
|
|
276
284
|
catch (error) {
|
|
277
285
|
closeSync(fd);
|