unbuffered cmd subprocess
This commit is contained in:
@@ -355,7 +355,7 @@ answer
|
|||||||
if DEBUG > 0:
|
if DEBUG > 0:
|
||||||
log(None, "DBG: cmd %s" % cmd)
|
log(None, "DBG: cmd %s" % cmd)
|
||||||
try:
|
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:
|
except OSError as e:
|
||||||
return "nsupdate: execution failed: %s" % e
|
return "nsupdate: execution failed: %s" % e
|
||||||
except:
|
except:
|
||||||
@@ -364,7 +364,12 @@ answer
|
|||||||
(output, err) = p.communicate(nsup.encode())
|
(output, err) = p.communicate(nsup.encode())
|
||||||
if output.decode().find("status: NOERROR") >= 0:
|
if output.decode().find("status: NOERROR") >= 0:
|
||||||
return None
|
return None
|
||||||
return output.decode() + err.decode()
|
if not err is None:
|
||||||
|
ex = err.decode()
|
||||||
|
else:
|
||||||
|
ex = "noerr"
|
||||||
|
|
||||||
|
return output.decode() + ex
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user