From 4ccfc5fcfc8fc5ad71399d4ad19f7b582b55a2b9 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 12 Jan 2022 10:05:27 +0100 Subject: [PATCH] unref the spawned script instance in order to allow it to end the backend process --- backend/src/webhook/github.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/webhook/github.ts b/backend/src/webhook/github.ts index 514e39e50..d7186bb10 100644 --- a/backend/src/webhook/github.ts +++ b/backend/src/webhook/github.ts @@ -1,5 +1,5 @@ // eslint-disable-next-line camelcase -import child_process from 'child_process' +import { spawn } from 'child_process' import path from 'path' import CONFIG from '../config' @@ -18,9 +18,10 @@ export const githubWebhook = async (req: any, res: any): Promise => { console.log(payload) if (payload.ref === `refs/heads/${CONFIG.WEBHOOK_GITHUB_BRANCH}`) { - child_process.execFile(path.join(__dirname, '../../../deployment/bare_metal/start.sh'), [ + const child = spawn(path.join(__dirname, '../../../deployment/bare_metal/start.sh'), [ CONFIG.WEBHOOK_GITHUB_BRANCH, ]) + child.unref() } } }