unbuffered cmd subprocess

This commit is contained in:
2024-06-03 15:40:31 -04:00
parent 4dd06a2969
commit f052baae75
+7 -2
View File
@@ -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
#