1 from __future__ import unicode_literals
5 from .common import PostProcessor
6 from ..compat import shlex_quote
7 from ..utils import PostProcessingError
10 class ExecAfterDownloadPP(PostProcessor):
11 def __init__(self, downloader=None, exec_cmd=None):
12 self.exec_cmd = exec_cmd
14 def run(self, information):
19 cmd = cmd.replace('{}', shlex_quote(information['filepath']))
21 self._downloader.to_screen("[exec] Executing command: %s" % cmd)
22 retCode = subprocess.call(cmd, shell=True)
24 raise PostProcessingError(
25 'Command returned error code %d' % retCode)
27 return [], information