Chronic for build scripts
Today I was working on a build script where I only wanted output if there were
failures (syntax errors, failing tests, lint errors etc…).
Most people when encountered with this are probably used to doing the
hacks to silence expected output.
There’s a better way
Or atleast more readable…
moreutils package which you probably already have on your machine
(If not you can do
sudo apt install moreutils) is a tasty little number
chronic (I’m also a fan of
vidir but we’ll leave that for another
chronic will only display any output if it exited with a non-zero exit status.
This is useful for build scripts and the like where you don’t want noise unless
Running it is as simple as prefixing your command with
phpunit --group myTestSuite
chronic phpunit --group myTestSuite
Enjoy your cleaner build scripts!