Skip to content

Commit e3ddcaf

Browse files
committed
Don't enforce and/or assume ReadUntil() responses have a LF suffix
The original telnetlib based approach using read_until() worked based on the fact that the string returned by read_until() always had a trailing LF (\n). This isn't the case with the way the response is returned by the raw socket based implementation (ie. using string.partition()), so don't add a trailing LF to the returned string anymore and fix up all occurances comparing with a string containing a trailing LF. (On a side note, it is simply wrong to statically append a LF where it would rather be correct to append the separator, but well...)
1 parent 2b7dbba commit e3ddcaf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

resources/lib/lcdproc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def ReadUntil(self, separator):
6161

6262
line, tmp, self.m_sockreadbuf = self.m_sockreadbuf.partition(separator)
6363

64-
return line + b"\n"
64+
return line
6565

6666
def SendCommand(self, strCmd, bCheckRet):
6767
countcmds = strCmd.count(b'\n')
@@ -113,10 +113,10 @@ def SendCommand(self, strCmd, bCheckRet):
113113
if not bCheckRet:
114114
continue # no return checking desired, so be fine
115115

116-
if strCmd == b'noop' and reply == b'noop complete\n':
116+
if strCmd == b'noop' and reply == b'noop complete':
117117
continue # noop has special reply
118118

119-
if reply == b'success\n':
119+
if reply == b'success':
120120
continue
121121

122122
ret = False

0 commit comments

Comments
 (0)