1
0
Fork 0

Only call sapi_windows_set_ctrl_handler() for CLI requests (#9771)

pull/9778/head
Brandon Kelly 2021-03-11 15:18:41 -08:00 committed by GitHub
parent 44bb82b50f
commit 7652408829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -405,7 +405,7 @@ EOT
} }
} }
// handler Ctrl+C for Windows on PHP 7.4+ // handler Ctrl+C for Windows on PHP 7.4+
if (function_exists('sapi_windows_set_ctrl_handler')) { if (function_exists('sapi_windows_set_ctrl_handler') && PHP_SAPI === 'cli') {
@mkdir($directory, 0777, true); @mkdir($directory, 0777, true);
if ($realDir = realpath($directory)) { if ($realDir = realpath($directory)) {
sapi_windows_set_ctrl_handler(function () use ($realDir) { sapi_windows_set_ctrl_handler(function () use ($realDir) {

View File

@ -208,7 +208,7 @@ class InstallationManager
}; };
$handleInterruptsUnix = function_exists('pcntl_async_signals') && function_exists('pcntl_signal'); $handleInterruptsUnix = function_exists('pcntl_async_signals') && function_exists('pcntl_signal');
$handleInterruptsWindows = function_exists('sapi_windows_set_ctrl_handler'); $handleInterruptsWindows = function_exists('sapi_windows_set_ctrl_handler') && PHP_SAPI === 'cli';
$prevHandler = null; $prevHandler = null;
$windowsHandler = null; $windowsHandler = null;
if ($handleInterruptsUnix) { if ($handleInterruptsUnix) {