build subprocess stdin near heartbeats
This commit is contained in:
parent
48123d7409
commit
f61a34eda7
1 changed files with 3 additions and 6 deletions
|
@ -542,19 +542,16 @@ class SendHeartbeatsThread(threading.Thread):
|
||||||
if self.has_extra_heartbeats:
|
if self.has_extra_heartbeats:
|
||||||
cmd.append('--extra-heartbeats')
|
cmd.append('--extra-heartbeats')
|
||||||
stdin = PIPE
|
stdin = PIPE
|
||||||
extra_heartbeats = [self.build_heartbeat(**x) for x in self.extra_heartbeats]
|
extra_heartbeats = json.dumps([self.build_heartbeat(**x) for x in self.extra_heartbeats])
|
||||||
extra_heartbeats = json.dumps(extra_heartbeats)
|
inp = "{0}\n".format(extra_heartbeats).encode('utf-8')
|
||||||
else:
|
else:
|
||||||
extra_heartbeats = None
|
extra_heartbeats = None
|
||||||
stdin = None
|
stdin = None
|
||||||
|
inp = None
|
||||||
|
|
||||||
log(DEBUG, ' '.join(obfuscate_apikey(cmd)))
|
log(DEBUG, ' '.join(obfuscate_apikey(cmd)))
|
||||||
try:
|
try:
|
||||||
process = Popen(cmd, stdin=stdin, stdout=PIPE, stderr=STDOUT)
|
process = Popen(cmd, stdin=stdin, stdout=PIPE, stderr=STDOUT)
|
||||||
inp = None
|
|
||||||
if self.has_extra_heartbeats:
|
|
||||||
inp = "{0}\n".format(extra_heartbeats)
|
|
||||||
inp = inp.encode('utf-8')
|
|
||||||
output, err = process.communicate(input=inp)
|
output, err = process.communicate(input=inp)
|
||||||
output = u(output)
|
output = u(output)
|
||||||
retcode = process.poll()
|
retcode = process.poll()
|
||||||
|
|
Loading…
Reference in a new issue