Skip to content

Commit

Permalink
fix: handle SIGTERM in build command (#5813)
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Oct 28, 2021
1 parent 96da25e commit 768600e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/docusaurus/src/commands/build.ts
Expand Up @@ -36,6 +36,10 @@ export default async function build(
// TODO what's the purpose of this arg ?
forceTerminate: boolean = true,
): Promise<string> {
['SIGINT', 'SIGTERM'].forEach((sig) => {
process.on(sig, () => process.exit());
});

async function tryToBuildLocale({
locale,
isLastLocale,
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus/src/commands/start.ts
Expand Up @@ -232,7 +232,7 @@ export default async function start(
});

['SIGINT', 'SIGTERM'].forEach((sig) => {
process.on(sig as NodeJS.Signals, () => {
process.on(sig, () => {
devServer.close();
process.exit();
});
Expand Down

0 comments on commit 768600e

Please sign in to comment.