mirror of
https://github.com/composer/composer
synced 2025-05-10 17:12:51 +00:00
Fix CTRL+C handling during create-project
This commit is contained in:
parent
20699905ab
commit
251a347efb
1 changed files with 10 additions and 7 deletions
|
@ -319,13 +319,16 @@ EOT
|
|||
}
|
||||
|
||||
// handler Ctrl+C for unix-like systems
|
||||
if (function_exists('pcntl_signal')) {
|
||||
declare(ticks=100);
|
||||
pcntl_signal(SIGINT, function () use ($directory) {
|
||||
$fs = new Filesystem();
|
||||
$fs->removeDirectory($directory);
|
||||
exit(130);
|
||||
});
|
||||
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($realDir);
|
||||
exit(130);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue