about summary refs log tree commit diff
path: root/kindlecomicconverter
diff options
context:
space:
mode:
authorPaweł Jastrzębski <pawelj@iosphe.re>2019-03-07 11:36:56 +0100
committerPaweł Jastrzębski <pawelj@iosphe.re>2019-03-07 11:36:56 +0100
commit259800e48b8622233d0a415d7a025f087de7e3cd (patch)
tree034e08eac3211b45647c6fd3f0248478b52ded4c /kindlecomicconverter
parentMerge pull request #306 from ciromattia/dev (diff)
downloadkcc-259800e48b8622233d0a415d7a025f087de7e3cd.tar.gz
kcc-259800e48b8622233d0a415d7a025f087de7e3cd.tar.bz2
kcc-259800e48b8622233d0a415d7a025f087de7e3cd.zip
Tweaks for Windows binary
Diffstat (limited to 'kindlecomicconverter')
-rw-r--r--kindlecomicconverter/KCC_gui.py9
-rwxr-xr-xkindlecomicconverter/comic2ebook.py6
-rw-r--r--kindlecomicconverter/comicarchive.py8
3 files changed, 12 insertions, 11 deletions
diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py
index 8449e37..283c41c 100644
--- a/kindlecomicconverter/KCC_gui.py
+++ b/kindlecomicconverter/KCC_gui.py
@@ -175,7 +175,8 @@ class VersionThread(QtCore.QThread):
                 move(path[0], path[0] + '.exe')
                 MW.hideProgressBar.emit()
                 MW.modeConvert.emit(1)
-                Popen(path[0] + '.exe  /SP- /silent /noicons', stdout=PIPE, stderr=STDOUT, shell=True)
+                Popen(path[0] + '.exe  /SP- /silent /noicons', stdout=PIPE, stderr=STDOUT, stdin=PIPE, close_fds=True,
+                      shell=True)
                 MW.forceShutdown.emit()
             except Exception:
                 MW.addMessage.emit('Failed to download the update!', 'warning', False)
@@ -836,11 +837,11 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
                 os.chmod('/usr/local/bin/kindlegen', 0o755)
             except Exception:
                 pass
-        kindleGenExitCode = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, shell=True)
+        kindleGenExitCode = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
         kindleGenExitCode.communicate()
         if kindleGenExitCode.returncode == 0:
             self.kindleGen = True
-            versionCheck = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, shell=True)
+            versionCheck = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
             for line in versionCheck.stdout:
                 line = line.decode("utf-8")
                 if 'Amazon kindlegen' in line:
@@ -991,7 +992,7 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
             self.addMessage('Since you are a new user of <b>KCC</b> please see few '
                             '<a href="https://github.com/ciromattia/kcc/wiki/Important-tips">important tips</a>.',
                             'info')
-        process = Popen('7z', stdout=PIPE, stderr=STDOUT, shell=True)
+        process = Popen('7z', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
         process.communicate()
         if process.returncode == 0 or process.returncode == 7:
             self.sevenzip = True
diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py
index 7800414..3fe2333 100755
--- a/kindlecomicconverter/comic2ebook.py
+++ b/kindlecomicconverter/comic2ebook.py
@@ -1033,13 +1033,13 @@ def checkTools(source):
     source = source.upper()
     if source.endswith('.CB7') or source.endswith('.7Z') or source.endswith('.RAR') or source.endswith('.CBR') or \
             source.endswith('.ZIP') or source.endswith('.CBZ'):
-        process = Popen('7z', stdout=PIPE, stderr=STDOUT, shell=True)
+        process = Popen('7z', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
         process.communicate()
         if process.returncode != 0 and process.returncode != 7:
             print('ERROR: 7z is missing!')
             exit(1)
     if options.format == 'MOBI':
-        kindleGenExitCode = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, shell=True)
+        kindleGenExitCode = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
         kindleGenExitCode.communicate()
         if kindleGenExitCode.returncode != 0:
             print('ERROR: KindleGen is missing!')
@@ -1188,7 +1188,7 @@ def makeMOBIWorker(item):
     try:
         if os.path.getsize(item) < 629145600:
             output = Popen('kindlegen -dont_append_source -locale en "' + item + '"',
-                           stdout=PIPE, stderr=STDOUT, shell=True)
+                           stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
             for line in output.stdout:
                 line = line.decode('utf-8')
                 # ERROR: Generic error
diff --git a/kindlecomicconverter/comicarchive.py b/kindlecomicconverter/comicarchive.py
index 435a99c..2235a42 100644
--- a/kindlecomicconverter/comicarchive.py
+++ b/kindlecomicconverter/comicarchive.py
@@ -32,7 +32,7 @@ class ComicArchive:
         self.type = None
         if not os.path.isfile(self.filepath):
             raise OSError('File not found.')
-        process = Popen('7z l -y -p1 "' + self.filepath + '"', stderr=STDOUT, stdout=PIPE, shell=True)
+        process = Popen('7z l -y -p1 "' + self.filepath + '"', stderr=STDOUT, stdout=PIPE, stdin=PIPE, shell=True)
         for line in process.stdout:
             if b'Type =' in line:
                 self.type = line.rstrip().decode().split(' = ')[1].upper()
@@ -47,7 +47,7 @@ class ComicArchive:
         if not os.path.isdir(targetdir):
             raise OSError('Target directory don\'t exist.')
         process = Popen('7z x -y -xr!__MACOSX -xr!.DS_Store -xr!thumbs.db -xr!Thumbs.db -o"' + targetdir + '" "' +
-                        self.filepath + '"', stdout=PIPE, stderr=STDOUT, shell=True)
+                        self.filepath + '"', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
         process.communicate()
         if process.returncode != 0:
             raise OSError('Failed to extract archive.')
@@ -64,14 +64,14 @@ class ComicArchive:
         if self.type in ['RAR', 'RAR5']:
             raise NotImplementedError
         process = Popen('7z a -y "' + self.filepath + '" "' + sourcefile + '"',
-                        stdout=PIPE, stderr=STDOUT, shell=True)
+                        stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
         process.communicate()
         if process.returncode != 0:
             raise OSError('Failed to add the file.')
 
     def extractMetadata(self):
         process = Popen('7z x -y -so "' + self.filepath + '" ComicInfo.xml',
-                        stdout=PIPE, stderr=STDOUT, shell=True)
+                        stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
         xml = process.communicate()
         if process.returncode != 0:
             raise OSError('Failed to extract archive.')