fix execute command test utility for configd

This commit is contained in:
Ad Schellevis 2015-03-06 14:15:17 +01:00
parent 7ac44e8c7b
commit 5bddaab1ca
2 changed files with 11 additions and 4 deletions

View File

@ -59,6 +59,7 @@ else:
if line:
data = data + line
# end of stream marker found, exit
if data.find("%c%c%c"%(chr(0),chr(0),chr(0))) > -1:
break

View File

@ -63,13 +63,19 @@ except socket.error, msg:
try:
print ('send:%s '%exec_command)
sock.send(exec_command)
data = []
data = ""
while True:
line = sock.recv(4096)
if line:
data.append(line)
else:
data = data + line
# end of stream marker found, exit
if data.find("%c%c%c"%(chr(0),chr(0),chr(0))) > -1:
break
print ('response:%s'% ''.join(data) )
print ('response:%s'% data[:-3] )
finally:
sock.close()