Python subprocess: Know when a command has finished
<p>I need a way to know when ffmpeg has finished its work. Here is my <a href="https://bitbucket.org/philipyassin/derusher/src/master/derusher.py?fileviewer=file-view-default" rel="nofollow">code</a>:</p>

<pre><code>def on_button_clicked(self, button, progress_bar, filename):
  self.execute(progress_bar, filename)
  progress_bar.set_text('Encoding')
  progress_bar.pulse()

def execute(self, progress_bar, filename):

  cmd = ['ffmpeg', '-y',
         '-i', filename,
         '-r', '30',
         '/tmp/test-encode.mkv']

  process = sp.Popen(cmd, stdin=open(os.devnull))

  progress_bar.set_text('Done')
</code></pre>

<p>The 'Done' never shows up. The job is done, though. I can see in the shell window that ffmpeg is done. How can I get the signal?</p>