Skip to content

Commit 348decf

Browse files
committed
Fix Windows missing SIGINT bug
1 parent 92483cf commit 348decf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/SPC/command/CraftCommand.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,13 @@ private function runCommand(string $cmd, ...$args): int
148148

149149
if (PHP_OS_FAMILY === 'Windows') {
150150
sapi_windows_set_ctrl_handler(function () use ($process) {
151-
$process->signal(SIGINT);
151+
if ($process->isRunning()) {
152+
$process->signal(-1073741510);
153+
}
152154
});
153155
} elseif (extension_loaded('pcntl')) {
154156
pcntl_signal(SIGINT, function () use ($process) {
157+
/* @noinspection PhpComposerExtensionStubsInspection */
155158
$process->signal(SIGINT);
156159
});
157160
} else {

0 commit comments

Comments
 (0)