From be11bb94d7cc594a96483d3adc5030e62d0ba43f Mon Sep 17 00:00:00 2001 From: Tor Wingalen Date: Fri, 15 May 2026 23:45:59 +0200 Subject: [PATCH] Replace Redis shell exec with spawn --- src/backend/src/main.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/backend/src/main.ts b/src/backend/src/main.ts index 58cb61a..d360536 100644 --- a/src/backend/src/main.ts +++ b/src/backend/src/main.ts @@ -4,7 +4,7 @@ import { HttpExceptionFilter } from './shared/filters/http-exception.filter'; import { AppModule } from './app.module'; import * as fs from 'fs'; import { resolve } from 'path'; -import { exec } from 'child_process'; +import { spawn } from 'child_process'; import helmet from 'helmet'; import { EnvironmentEnum } from './environmentEnum'; @@ -27,7 +27,16 @@ async function bootstrap() { try { // Convenience mode for the single-container Docker image. // Hardened deployments should prefer an external Redis service. - exec(`redis-server --port ${process.env.REDIS_PORT || 6379}`); + const redisProcess = spawn( + 'redis-server', + ['--port', String(process.env.REDIS_PORT || 6379)], + { + stdio: 'ignore', + detached: true, + }, + ); + + redisProcess.unref(); } catch (e) { console.log('Unable to run redis server from app'); console.log(e);