Skip to content

Commit 18c6336

Browse files
MatmaRexdantleech
authored andcommitted
Make the use of POSIX signals optional
Signals are not supported on Windows, and gracefully shutting down everything doesn't seem necessary if we're about to exit anyway.
1 parent e547efe commit 18c6336

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/Core/Server/LanguageServer.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,13 @@ public function start(): Promise
9393
*/
9494
public function run(): void
9595
{
96-
Loop::onSignal(SIGINT, function (string $watcherId) {
97-
Loop::cancel($watcherId);
98-
yield $this->shutdown();
99-
});
96+
// Signals are not supported on Windows
97+
if(defined('SIGINT')) {
98+
Loop::onSignal(SIGINT, function (string $watcherId) {
99+
Loop::cancel($watcherId);
100+
yield $this->shutdown();
101+
});
102+
}
100103

101104
Loop::setErrorHandler(function (Throwable $error): void {
102105
if ($error instanceof ShutdownServer) {

0 commit comments

Comments
 (0)