1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-26 01:50:31 +00:00

Get rid of shel=true again

This commit is contained in:
Ozzie Isaacs 2017-04-26 19:39:45 +01:00
parent 2d918bfb72
commit 4259aa69df

View File

@ -66,9 +66,9 @@ def make_mobi(book_id, calibrepath):
vendorpath = os.path.join(os.path.normpath(os.path.dirname(os.path.realpath(__file__)) + vendorpath = os.path.join(os.path.normpath(os.path.dirname(os.path.realpath(__file__)) +
os.sep + "../vendor" + os.sep)) os.sep + "../vendor" + os.sep))
if sys.platform == "win32": if sys.platform == "win32":
kindlegen = os.path.join(vendorpath, u"kindlegen.exe") kindlegen = (os.path.join(vendorpath, u"kindlegen.exe")).encode(sys.getfilesystemencoding())
else: else:
kindlegen = os.path.join(vendorpath, u"kindlegen") kindlegen = (os.path.join(vendorpath, u"kindlegen")).encode(sys.getfilesystemencoding())
if not os.path.exists(kindlegen): if not os.path.exists(kindlegen):
app.logger.error("make_mobi: kindlegen binary not found in: %s" % kindlegen) app.logger.error("make_mobi: kindlegen binary not found in: %s" % kindlegen)
return None return None
@ -80,8 +80,8 @@ def make_mobi(book_id, calibrepath):
file_path = os.path.join(calibrepath, book.path, data.name) file_path = os.path.join(calibrepath, book.path, data.name)
if os.path.exists(file_path + u".epub"): if os.path.exists(file_path + u".epub"):
p = subprocess.Popen((kindlegen + " \"" + file_path + u".epub\"").encode(sys.getfilesystemencoding()), p = subprocess.Popen([kindlegen, ("\"" + file_path + u".epub\"").encode(sys.getfilesystemencoding())],
stdout=subprocess.PIPE, stderr=subprocess.PIPE,shell=True ) stdout=subprocess.PIPE, stderr=subprocess.PIPE )
# Poll process for new output until finished # Poll process for new output until finished
while True: while True:
nextline = p.stdout.readline() nextline = p.stdout.readline()