pawamoy / failprint

Run a command, print its output only if it fails.
https://pawamoy.github.io/failprint
ISC License
7 stars 0 forks source link

Allow running Python function #4

Closed pawamoy closed 3 years ago

pawamoy commented 4 years ago

Is your feature request related to a problem? Please describe. In the same way as #3, Python processes are expensive. Moreover, there's not always an executable file or a Python module we can call.

Describe the solution you'd like Being able to run a Python function. Basically, failprint would run the function and catch stdout and stderr, catch any exception and return 1, or return 0 if bool(func_result) or 1.

pawamoy commented 3 years ago

Done, you can pass a callable to failprint.runners.run.