From b920e7c0f1ddd403f15d8c12944d4e5729a1f234 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 29 Jun 2025 21:10:11 -0600 Subject: [PATCH] fix: handle potential null data in PID extraction for runCommand function --- packages/server/src/utils/schedules/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/src/utils/schedules/utils.ts b/packages/server/src/utils/schedules/utils.ts index d2e3d3606..eacf83d3a 100644 --- a/packages/server/src/utils/schedules/utils.ts +++ b/packages/server/src/utils/schedules/utils.ts @@ -119,7 +119,7 @@ export const runCommand = async (scheduleId: string) => { async (data) => { if (writeStream.writable) { // we need to extract the PID and Schedule ID from the data - const pid = data.match(/PID: (\d+)/)?.[1]; + const pid = data?.match(/PID: (\d+)/)?.[1]; if (pid) { await updateDeployment(deployment.deploymentId, { @@ -152,7 +152,7 @@ export const runCommand = async (scheduleId: string) => { `; await execAsyncRemote(serverId, command, async (data) => { // we need to extract the PID and Schedule ID from the data - const pid = data.match(/PID: (\d+)/)?.[1]; + const pid = data?.match(/PID: (\d+)/)?.[1]; if (pid) { await updateDeployment(deployment.deploymentId, { pid,