Skip to content

1.3.0

Compare
Choose a tag to compare
@mlebkowski mlebkowski released this 06 Nov 09:45
· 17 commits to main since this release
a05736d

For all those pesky cron jobs, where on one hand you’d like to silence the output because it causes noisy emails for no reason, but at the same time you don’t want to lose context when something bad happens. Wrap your commands in a FingersCrossedHandler like so:

public function execute(InputInterface $input, OutputInterface $output): int {
    return FingersCrossedHandler::of($input, $output)->run(
        function (InputParams $input, FingersCrossedOutput $output) {
            $output->write("Hello world!")
            return 1;
        },
    );
}

The output will be silenced except for the following situatios:

  • You increase the output verbosity using the -v flag or the setVerbosity() method
  • The command returns a non-zero exit code
  • The command throws

In the former case, the output will be written in realtime, and in the two latter ones you can expect it writtein in bulk at the end.