From 41e3f2e5ede8951e4e2a58085718c790aef6477c Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 14 Jul 2016 11:35:32 +0200 Subject: [PATCH] explicit flush stdout/stderr before exit, because of possible buffered output in python (echo or grep `fail2ban-client --version` can sometimes returns nothing) --- fail2ban/client/fail2bancmdline.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fail2ban/client/fail2bancmdline.py b/fail2ban/client/fail2bancmdline.py index 4cb1927e..a14a1cf4 100644 --- a/fail2ban/client/fail2bancmdline.py +++ b/fail2ban/client/fail2bancmdline.py @@ -270,6 +270,10 @@ class Fail2banCmdLine(): @staticmethod def exit(code=0): logSys.debug("Exit with code %s", code) + # because of possible buffered output in python, we should flush it before exit: + sys.stdout.flush() + sys.stderr.flush() + # exit Fail2banCmdLine._exit(code)