mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:Make job control a little more robust
This commit is contained in:
parent
4e9dc3e87f
commit
532820ad8f
@ -77,6 +77,8 @@ def check_links(opf_path, pretty_print):
|
||||
html_files.append(os.path.abspath(content(f)))
|
||||
|
||||
for path in html_files:
|
||||
if not os.access(path, os.R_OK):
|
||||
continue
|
||||
base = os.path.dirname(path)
|
||||
root = html.fromstring(open(content(path), 'rb').read(), parser=parser)
|
||||
for element, attribute, link, pos in list(root.iterlinks()):
|
||||
|
@ -286,7 +286,7 @@ def write(socket, msg, timeout=5):
|
||||
def read(socket, timeout=5):
|
||||
'''
|
||||
Read a message from `socket`. The message must have been sent with the :function:`write`
|
||||
function. Raises a `RuntimeError` if the message is corrpted. Can return an
|
||||
function. Raises a `RuntimeError` if the message is corrupted. Can return an
|
||||
empty string.
|
||||
'''
|
||||
if isworker:
|
||||
@ -299,7 +299,12 @@ def read(socket, timeout=5):
|
||||
if not msg:
|
||||
break
|
||||
if length is None:
|
||||
length, msg = int(msg[:12]), msg[12:]
|
||||
try:
|
||||
length, msg = int(msg[:12]), msg[12:]
|
||||
except ValueError:
|
||||
if DEBUG:
|
||||
print >>sys.__stdout__, 'read(%s):'%('worker' if isworker else 'overseer'), 'no length in', msg
|
||||
return ''
|
||||
buf.write(msg)
|
||||
if buf.tell() >= length:
|
||||
break
|
||||
|
Loading…
x
Reference in New Issue
Block a user