1
0
Fork 0

Merge pull request #6979 from nicolas-grekas/fix-ctrl-c

Fix CTRL+C handling during create-project
pull/7006/head
Jordi Boggiano 2018-01-10 15:51:30 +01:00 committed by GitHub
commit 82b80a5451
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 7 deletions

View File

@ -319,14 +319,17 @@ EOT
}
// handler Ctrl+C for unix-like systems
if (function_exists('pcntl_signal')) {
declare(ticks=100);
pcntl_signal(SIGINT, function () use ($directory) {
if (function_exists('pcntl_async_signals')) {
@mkdir($directory, 0777, true);
if ($realDir = realpath($directory)) {
pcntl_async_signals(true);
pcntl_signal(SIGINT, function () use ($realDir) {
$fs = new Filesystem();
$fs->removeDirectory($directory);
$fs->removeDirectory($realDir);
exit(130);
});
}
}
$io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');