From 84b2b9ecde21289be6d46eb77fe1b6f25cd7bb33 2013-08-02 21:05:31 From: Paul Ivanov Date: 2013-08-02 21:05:31 Subject: [PATCH] wait for subprocess to finish --- diff --git a/IPython/nbconvert/post_processors/pdf.py b/IPython/nbconvert/post_processors/pdf.py index 959e6f4..b585b2a 100644 --- a/IPython/nbconvert/post_processors/pdf.py +++ b/IPython/nbconvert/post_processors/pdf.py @@ -44,9 +44,8 @@ class PDFPostProcessor(PostProcessorBase): """ command = [c.format(filename=input) for c in self.command] self.log.info("Building PDF: `%s`", ' '.join(command)) - for index in range(self.iteration_count): - if self.verbose: - subprocess.Popen(command) - else: - with open(os.devnull, 'wb') as null: - subprocess.Popen(command, stdout=null) + with open(os.devnull, 'wb') as null: + stdout = null if self.verbose else None + for index in range(self.iteration_count): + p = subprocess.Popen(command, stdout=stdout) + p.wait()