Skip to content

Commit 108a075

Browse files
committed
fix(core): add registerExitHandler utility
1 parent 76b3f57 commit 108a075

File tree

43 files changed

+138
-174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+138
-174
lines changed

packages/detox/src/executors/build/build.impl.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ export function runCliBuild(
4545

4646
// Ensure the child process is killed when the parent exits
4747
process.on('exit', () => childProcess.kill());
48-
process.on('SIGTERM', () => childProcess.kill());
4948

5049
childProcess.on('error', (err) => {
5150
reject(err);

packages/detox/src/executors/test/test.impl.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ function runCliTest(
6666

6767
// Ensure the child process is killed when the parent exits
6868
process.on('exit', () => childProcess.kill());
69-
process.on('SIGTERM', () => childProcess.kill());
7069

7170
childProcess.on('error', (err) => {
7271
reject(err);

packages/esbuild/src/executors/esbuild/esbuild.impl.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export async function* esbuildExecutor(
173173
})
174174
);
175175

176-
registerCleanupCallback(() => {
176+
process.once('exit', () => {
177177
assetsResult?.stop();
178178
packageJsonResult?.stop();
179179
disposeFns.forEach((fn) => fn());
@@ -269,17 +269,4 @@ async function runTypeCheck(
269269
return { errors, warnings };
270270
}
271271

272-
function registerCleanupCallback(callback: () => void) {
273-
const wrapped = () => {
274-
callback();
275-
process.off('SIGINT', wrapped);
276-
process.off('SIGTERM', wrapped);
277-
process.off('exit', wrapped);
278-
};
279-
280-
process.on('SIGINT', wrapped);
281-
process.on('SIGTERM', wrapped);
282-
process.on('exit', wrapped);
283-
}
284-
285272
export default esbuildExecutor;

packages/expo/src/executors/build-list/build-list.impl.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export function runCliBuildList(
5252

5353
// Ensure the child process is killed when the parent exits
5454
process.on('exit', () => childProcess.kill());
55-
process.on('SIGTERM', () => childProcess.kill());
5655

5756
let output = '';
5857
childProcess.stdout.on('data', (message) => {

packages/expo/src/executors/build/build.impl.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ function runCliBuild(
6868

6969
// Ensure the child process is killed when the parent exits
7070
process.on('exit', () => childProcess.kill());
71-
process.on('SIGTERM', () => childProcess.kill());
7271

7372
childProcess.on('error', (err) => {
7473
reject(err);

packages/expo/src/executors/export/export.impl.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ function exportAsync(
4848

4949
// Ensure the child process is killed when the parent exits
5050
process.on('exit', () => childProcess.kill());
51-
process.on('SIGTERM', () => childProcess.kill());
5251

5352
childProcess.on('error', (err) => {
5453
reject(err);

packages/expo/src/executors/prebuild/prebuild.impl.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export function prebuildAsync(
5555

5656
// Ensure the child process is killed when the parent exits
5757
process.on('exit', () => childProcess.kill());
58-
process.on('SIGTERM', () => childProcess.kill());
5958

6059
childProcess.on('error', (err) => {
6160
reject(err);

packages/expo/src/executors/run/run.impl.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ function runCliRun(
7070

7171
// Ensure the child process is killed when the parent exits
7272
process.on('exit', () => childProcess.kill());
73-
process.on('SIGTERM', () => childProcess.kill());
7473

7574
childProcess.on('error', (err) => {
7675
reject(err);

packages/expo/src/executors/start/start.impl.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ function startAsync(
5656

5757
// Ensure the child process is killed when the parent exits
5858
process.on('exit', () => childProcess.kill());
59-
process.on('SIGTERM', () => childProcess.kill());
6059

6160
childProcess.on('error', (err) => {
6261
reject(err);

packages/expo/src/executors/submit/submit.impl.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ function runCliSubmit(
4747

4848
// Ensure the child process is killed when the parent exits
4949
process.on('exit', () => childProcess.kill());
50-
process.on('SIGTERM', () => childProcess.kill());
5150

5251
childProcess.on('error', (err) => {
5352
reject(err);

0 commit comments

Comments
 (0)