Skip to content

Commit

Permalink
Unlink temp files on CTRL+C
Browse files Browse the repository at this point in the history
  • Loading branch information
ostrolucky committed Dec 30, 2018
1 parent 59cb8c5 commit 0d302b1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bin/stdinho
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ require_once file_exists(__DIR__.$autoloadPath) ? __DIR__.$autoloadPath : __DIR_

define('APP_NAME', basename(__FILE__));

/** Make temp files self clean on CTRL+C by interupting process termination and exiting cleanly instead.
*
* @see https://bugs.php.net/bug.php?id=77365
*/
if (function_exists('pcntl_signal')) {
pcntl_signal(SIGINT, function () {
exit(0);
});
}

$application = new Application(APP_NAME, PrettyVersions::getVersion('ostrolucky/'.APP_NAME));
$application->add($command = new Command(APP_NAME));
$application
Expand Down

0 comments on commit 0d302b1

Please sign in to comment.