Clean up old savegames at the end of each loop iteration.

@param Shell $shell
342445
public function afterLoop(Shell $shell)
    {
        // if there's an old savegame hanging around, let's kill it.
        if (isset($this->savegame)) {
            \posix_kill($this->savegame, SIGKILL);
            \pcntl_signal_dispatch();
        }
    }
1204932
function cleanup()
    {
        // destroy loop variable(s)
        foreach ( $this->LoopVariablesNames as $varName )
            $this->Tpl->unsetVariable( $varName, $this->RootNamespace );
    }
525574
public function cleanup()
    {
        Cache::clear(false, 'default');
        Cache::clear(false, '_cake_model_');
        Cache::clear(false, '_cake_core_');
        $this->dispatchShell('orm_cache clear');
        $this->dispatchShell('orm_cache build');
    }
1267755
public function end()
    {
        /**
         * This event is triggered after archiving.
         *
         * @param CronArchive $this
         */
        Piwik::postEvent('CronArchive.end', array($this));

        if (empty($this->errors)) {
            // No error -> Logs the successful script execution until completion
            Option::set(self::OPTION_ARCHIVING_FINISHED_TS, time());
            return;
        }

        $this->logSection("SUMMARY OF ERRORS");
        foreach ($this->errors as $error) {
            // do not logError since errors are already in stderr
            $this->logger->info("Error: " . $error);
        }

        $summary = count($this->errors) . " total errors during this script execution, please investigate and try and fix these errors.";
        $this->logFatalError($summary);
    }
290546
protected function cleanup($fileToRotate)
    {

        // load the maximum number of files to keep
        $maxFiles = $this->getMaxFiles();

        // skip GC of old logs if files are unlimited
        if (0 === $maxFiles) {
            return;
        }

        // load the rotated log files
        $logFiles = glob($this->getGlobPattern($fileToRotate, 'gz'));

        // query whether we've the maximum number of files reached
        if ($maxFiles >= count($logFiles)) {
            return;
        }

        // iterate over the files we want to clean-up
        foreach (array_slice($logFiles, $maxFiles) as $fileToDelete) {
            unlink($fileToDelete);
        }
    }
687386
protected function runShell(Shell $shell, array $argv)
    {
        try {
            $shell->initialize();

            return $shell->runCommand($argv, true);
        } catch (StopException $e) {
            return $e->getCode();
        }
    }
1227059
def cleanup():
    
    script_dir = os.path.dirname(__file__) if not os.path.islink(__file__) else os.path.dirname(os.readlink(__file__))
    script_dir = os.path.realpath(os.path.join(script_dir, ".."))
    shutil.rmtree(os.path.join(script_dir, "dist"), ignore_errors=True)
    shutil.rmtree(os.path.join(script_dir, "tmp"), ignore_errors=True)
    shutil.rmtree(os.path.join(script_dir, "urh.egg-info"), ignore_errors=True)
    shutil.rmtree(os.path.join(script_dir, "src", "urh.egg-info"), ignore_errors=True)
    shutil.rmtree(os.path.join(script_dir, "src", "urh", "tmp"), ignore_errors=True)
488285
public function clean()
    {
        $jobFiles = glob($this->getLocation() . '*.js');
        foreach ($jobFiles as $file) {
            unlink($file);
        }
    }
68734
private function cleanUp()
    {
        if ($this->quiet) {
            $errors = explode(PHP_EOL, ob_get_clean());
            $shown = [];

            foreach ($errors as $error) {
                if ($error && !in_array($error, $shown)) {
                    out($error, 'error');
                    $shown[] = $error;
                }
            }
        }

        if (file_exists($this->tmpPharPath)) {
            @unlink($this->tmpPharPath);
        }
        if (file_exists($this->tmpPubkeyPath)) {
            @unlink($this->tmpPharPath);
        }
    }
434717
public function clean($expiration)
    {
        $files = glob($this->path . '*');

        if ($files === false) {
            return;
        }

        foreach ($files as $file) {
            if (filetype($file) == 'file' && filemtime($file) < $expiration) {
                unlink($file);
            }
        }
    }
246825
public function save() {
        if ($this->_oldFile != $this->path . $this->name) {
            unlink($this->_oldFile);
        }

        file_put_contents($this->path . $this->name, $this->content);
    }
638044
public function clear()
    {

        try {

            DB::table($this->table)->truncate();

        } catch (\Exception $e) {

            throw new SaveException("Cannot clear database: " . $e->getMessage());

        }

    }
205300
private void cleanup() {
    if (operation instanceof Command && log.isOpen()) {
      try {
        log.release(index);
      } catch (IllegalStateException e) {
      }
    }

    session.release();

    index = 0;
    session = null;
    instant = null;
    operation = null;

    pool.release(this);
  }
803696
public function setShell(Shell $shell)
    {
        $this->shell = $shell;
        $this->doAddCommands();
        $this->doAddMatchers();
    }
4923
protected function clean()
    {
        if ($this->exists()) {
            $id = shmop_open($this->id, "a", 0, 0);
            shmop_delete($id);
            shmop_close($id);
        }
    }
562015
private function planetCleanup($planet)
    {

        // cleaning all waypoints
        $this->cleanRouteWaypoints($planet);

        // cleaning all routes
        $this->cleanRoutes($planet);

        // cleaning links
        $this->cleanLinks($planet);

        // cleaning contents
        $this->cleanContents($planet);

        // cleaning heads
        $this->cleanHeads($planet);

        // cleaning extractors
        $this->cleanExtractors($planet);

        // cleaning factories
        $this->cleanFactories($planet);

        // cleaning pins
        $this->cleanPins($planet);

        $this->resetCollections();
    }
1274546
public function clear()
    {
        $shmid = shm_attach($this->sysvKey, $this->shmSize, $this->perm);
        shm_remove_var($shmid, self::VAR_KEY);
    }