Skip to content

Commit d64f979

Browse files
committed
Forwards SIGTERM signals
1 parent d5b532c commit d64f979

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/cli/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,8 @@ async function start(): Promise<void> {
638638
// innermost process, whose end will cause our own to exit.
639639
});
640640

641+
handleSignals();
642+
641643
try {
642644
if (/\.[cm]?js$/.test(yarnPath)) {
643645
exitCode = await spawnp(process.execPath, [yarnPath, ...argv], opts);

src/util/child.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ let uid = 0;
1616
export const exec = promisify(child.exec);
1717

1818
export function forkp(program: string, args: Array<string>, opts?: Object): Promise<number> {
19+
const key = String(++uid);
1920
return new Promise((resolve, reject) => {
2021
const proc = child.fork(program, args, opts);
22+
spawnedProcesses[key] = proc;
2123

2224
proc.on('error', error => {
2325
reject(error);
@@ -30,8 +32,10 @@ export function forkp(program: string, args: Array<string>, opts?: Object): Prom
3032
}
3133

3234
export function spawnp(program: string, args: Array<string>, opts?: Object): Promise<number> {
35+
const key = String(++uid);
3336
return new Promise((resolve, reject) => {
3437
const proc = child.spawn(program, args, opts);
38+
spawnedProcesses[key] = proc;
3539

3640
proc.on('error', error => {
3741
reject(error);

0 commit comments

Comments
 (0)