Skip to content

Commit

Permalink
Make the use of POSIX signals optional
Browse files Browse the repository at this point in the history
Signals are not supported on Windows, and gracefully shutting down
everything doesn't seem necessary if we're about to exit anyway.
  • Loading branch information
MatmaRex authored and dantleech committed Mar 2, 2024
1 parent e547efe commit 18c6336
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/Core/Server/LanguageServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,13 @@ public function start(): Promise
*/
public function run(): void
{
Loop::onSignal(SIGINT, function (string $watcherId) {
Loop::cancel($watcherId);
yield $this->shutdown();
});
// Signals are not supported on Windows
if(defined('SIGINT')) {
Loop::onSignal(SIGINT, function (string $watcherId) {
Loop::cancel($watcherId);
yield $this->shutdown();
});
}

Loop::setErrorHandler(function (Throwable $error): void {
if ($error instanceof ShutdownServer) {
Expand Down

0 comments on commit 18c6336

Please sign in to comment.