mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 14:22:02 +00:00
fix: guard signal forwarding against race conditions
This commit is contained in:
@@ -119,9 +119,13 @@ function runBashScript() {
|
||||
process.exit(code ?? 0);
|
||||
});
|
||||
|
||||
// Forward signals to child process
|
||||
process.on('SIGINT', () => child.kill('SIGINT'));
|
||||
process.on('SIGTERM', () => child.kill('SIGTERM'));
|
||||
// Forward signals to child process (guard against race conditions)
|
||||
process.on('SIGINT', () => {
|
||||
if (!child.killed) child.kill('SIGINT');
|
||||
});
|
||||
process.on('SIGTERM', () => {
|
||||
if (!child.killed) child.kill('SIGTERM');
|
||||
});
|
||||
}
|
||||
|
||||
runBashScript();
|
||||
|
||||
Reference in New Issue
Block a user