Skip to content

Commit

Permalink
fix(zero-cache): do not detach forked processes in windows (#3560)
Browse files Browse the repository at this point in the history
  • Loading branch information
darkgnotic authored Jan 18, 2025
1 parent b332fdd commit 0c3f2d0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/zero-cache/src/types/processes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
type Serializable,
} from 'node:child_process';
import EventEmitter from 'node:events';
import {platform} from 'node:os';
import path from 'node:path';
import {pid} from 'node:process';

Expand Down Expand Up @@ -182,7 +183,11 @@ export function childWorker(
return child;
}
const child = fork(moduleUrl, args, {
detached: true, // do not automatically propagate SIGINT
// For production / non-windows, set `detached` to `true` so that SIGINT is
// not automatically propagated and graceful shutdown happens as intended.
// For Win32, detached: true causes all subprocesses to open in separate
// terminals and breaks inter-process kill signals, so set it to false.
detached: platform() !== 'win32',
serialization: 'advanced', // use structured clone for IPC
env,
// silent: true,
Expand Down

0 comments on commit 0c3f2d0

Please sign in to comment.