Skip to content

Commit

Permalink
Use trap method instead of pcntl_signal for better signal handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Thavarshan committed May 27, 2024
1 parent f90c06d commit 3f3ca86
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Commands/TopCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public function handle(GuiBuilder $guiBuilder): void
Loop::addPeriodicTimer(0.5, fn () => $guiBuilder->moveToTop()->render());
Loop::addPeriodicTimer(1, fn () => $this->feed($guiBuilder));

pcntl_signal(SIGINT, function () use ($guiBuilder) {
$this->trap(SIGINT, function () use ($guiBuilder) {
$guiBuilder
->exitAlternateScreen()
->showCursor();
exit(0);
exit();
});
}

Expand Down

0 comments on commit 3f3ca86

Please sign in to comment.