From 91007a64d3f66266f44713c3af42cb60c46c04a0 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 7 Jun 2022 15:00:06 +0500 Subject: [PATCH 1/2] Handle multiple file changes. Without it if multiple changes occured at once, it will try to start process multiple times. --- lib/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/index.js b/lib/index.js index 75dac54..acac37e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -65,6 +65,7 @@ module.exports = function ( let child; watcher.on('change', file => { + if (isPaused) return; clearOutput(); notify('Restarting', `${file} has been modified`); watcher.removeAll(); From 2e6e7f59f2b62fc843c4d1098e2a4f3aa03b201f Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 12 Jan 2023 23:38:43 +0500 Subject: [PATCH 2/2] Set isPaused to true right after the change. --- lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index acac37e..1bab526 100644 --- a/lib/index.js +++ b/lib/index.js @@ -66,10 +66,10 @@ module.exports = function ( watcher.on('change', file => { if (isPaused) return; + isPaused = true; clearOutput(); notify('Restarting', `${file} has been modified`); - watcher.removeAll(); - isPaused = true; + watcher.removeAll(); if (child) { // Child is still running, restart upon exit child.on('exit', start);