parent
326a9c3409
commit
a14e510a34
|
@ -60,17 +60,18 @@ class Speller(object):
|
|||
if word in self.cache:
|
||||
result = self.cache[word]
|
||||
else:
|
||||
if self.pipe.poll() >= 0:
|
||||
res = self.pipe.poll()
|
||||
if res is None or res >= 0:
|
||||
self.pipe = None
|
||||
self.start()
|
||||
self.pipe.stdin.write("%s\n" % (word))
|
||||
self.pipe.stdin.write(word.encode('utf-8') + b'\n') #"%s\n" % (word))
|
||||
self.pipe.stdin.flush()
|
||||
l = self.pipe.stdout.readline()
|
||||
if l.startswith("*") or l.startswith("+") or l.startswith("-"):
|
||||
if l.startswith(b"*") or l.startswith(b"+") or l.startswith(b"-"):
|
||||
result = True
|
||||
while True:
|
||||
l = self.pipe.stdout.readline()
|
||||
if l == "\n":
|
||||
if l == b"\n":
|
||||
break
|
||||
self.cache[word] = result
|
||||
return result
|
||||
|
|
Loading…
Reference in New Issue