From f052baae75be0d9ca1ee23b14fba887b9f42c32c Mon Sep 17 00:00:00 2001 From: Andreas Wrede Date: Mon, 3 Jun 2024 15:40:31 -0400 Subject: [PATCH] unbuffered cmd subprocess --- hbd | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hbd b/hbd index 2a5ce54..3979d65 100755 --- a/hbd +++ b/hbd @@ -355,7 +355,7 @@ answer if DEBUG > 0: log(None, "DBG: cmd %s" % cmd) try: - p = Popen(cmd, shell=False, bufsize=1, stdin=PIPE, stdout=PIPE, stderr=STDOUT) + p = Popen(cmd, shell=False, bufsize=0, stdin=PIPE, stdout=PIPE, stderr=STDOUT) except OSError as e: return "nsupdate: execution failed: %s" % e except: @@ -364,7 +364,12 @@ answer (output, err) = p.communicate(nsup.encode()) if output.decode().find("status: NOERROR") >= 0: return None - return output.decode() + err.decode() + if not err is None: + ex = err.decode() + else: + ex = "noerr" + + return output.decode() + ex #