fix: handle SIGTERM in build command (#5813)

This commit is contained in:
Sébastien Lorber 2021-10-28 19:20:07 +02:00 committed by GitHub
parent 96da25e422
commit 768600e5d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -36,6 +36,10 @@ export default async function build(
// TODO what's the purpose of this arg ? // TODO what's the purpose of this arg ?
forceTerminate: boolean = true, forceTerminate: boolean = true,
): Promise<string> { ): Promise<string> {
['SIGINT', 'SIGTERM'].forEach((sig) => {
process.on(sig, () => process.exit());
});
async function tryToBuildLocale({ async function tryToBuildLocale({
locale, locale,
isLastLocale, isLastLocale,

View file

@ -232,7 +232,7 @@ export default async function start(
}); });
['SIGINT', 'SIGTERM'].forEach((sig) => { ['SIGINT', 'SIGTERM'].forEach((sig) => {
process.on(sig as NodeJS.Signals, () => { process.on(sig, () => {
devServer.close(); devServer.close();
process.exit(); process.exit();
}); });