rcrowe / TwigBridge

Give the power of Twig to Laravel
MIT License
894 stars 168 forks source link

twig:clean should return non-zero on failure #275

Open philer opened 8 years ago

philer commented 8 years ago

Running artisan twig:clean outputs a simple error string on failure, but doesn't actually return a non-zero integer as is conventionally the case for console commands. This makes it a lot harder to check for successful execution both on the command line (in a script) and when running commands as part of an application like Artisan::call('twig:clean').

The solution is fairly simple. In Command\Clean::fire add two return statements like:

<?php
        // ...
        if ($files->exists($cacheDir)) {
            $this->error('Twig cache failed to be cleaned');
            return 1;
        } else {
            $this->info('Twig cache cleaned');
            return 0;
        }