Skip to content

Commit 56713f3

Browse files
authored
Make the use of POSIX signals optional (#21)
Signals are not supported on Windows, and gracefully shutting down everything doesn't seem necessary if we're about to exit anyway.
1 parent 8b79e76 commit 56713f3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

bin/watch

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ Loop::run(function () use ($watcher, $path) {
4747
fwrite(STDOUT, sprintf('[%s] %s (%s)'."\n", date('Y-m-d H:i:s.u'), $file->path(), $file->type()));
4848
}
4949

50-
Loop::onSignal(SIGINT, function () use ($process) {
51-
$process->stop();
52-
Loop::stop();
53-
});
50+
// Signals are not supported on Windows
51+
if(defined('SIGINT')) {
52+
Loop::onSignal(SIGINT, function () use ($process) {
53+
$process->stop();
54+
Loop::stop();
55+
});
56+
}
5457
});

0 commit comments

Comments
 (0)