From d37071dae087ad68c3e24e4fea08ee9d558315f8 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Wed, 4 Mar 2026 00:49:29 +0000 Subject: [PATCH] fix(spawn): use detached:true so children are immune to terminal SIGINT Children now get their own process group. Terminal Ctrl+C only reaches the parent, which then does orderly tree-kill while children are still alive and the process tree is intact. --- package.json | 2 +- ts/classes.smartshell.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 7da8485..0db47e8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@push.rocks/smartshell", "private": false, - "version": "3.3.4", + "version": "3.3.5", "description": "A library for executing shell commands using promises.", "main": "dist_ts/index.js", "typings": "dist_ts/index.d.ts", diff --git a/ts/classes.smartshell.ts b/ts/classes.smartshell.ts index e1af848..1853d69 100644 --- a/ts/classes.smartshell.ts +++ b/ts/classes.smartshell.ts @@ -119,7 +119,7 @@ export class Smartshell { shell: false, // SECURITY: Never use shell with untrusted input cwd: process.cwd(), env: options.env || process.env, - detached: false, + detached: true, // Own process group — immune to terminal SIGINT, managed by smartexit signal: options.signal, }); @@ -342,7 +342,7 @@ export class Smartshell { shell: true, cwd: process.cwd(), env: options.env || process.env, - detached: false, + detached: true, // Own process group — immune to terminal SIGINT, managed by smartexit signal: options.signal, });