many parts might block PIPE, use /dev/null

This commit is contained in:
j 2017-11-08 14:33:23 +01:00
parent 7cbb46458a
commit 35c26f095f

View file

@ -494,7 +494,7 @@ class Item(models.Model):
if format == "webm": if format == "webm":
cmd = ['mkvmerge', '-o', output] cmd = ['mkvmerge', '-o', output]
cmd += [streams[0]] + ['+' + s for s in streams[1:]] cmd += [streams[0]] + ['+' + s for s in streams[1:]]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) p = subprocess.Popen(cmd, stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w'), close_fds=True)
p.wait() p.wait()
return True return True
elif format == "mp4": elif format == "mp4":
@ -502,7 +502,7 @@ class Item(models.Model):
shutil.copy(streams[0], tmp_output) shutil.copy(streams[0], tmp_output)
for s in streams[1:]: for s in streams[1:]:
cmd = ['MP4Box', '-cat', s, tmp_output] cmd = ['MP4Box', '-cat', s, tmp_output]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) p = subprocess.Popen(cmd, stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w'), close_fds=True)
p.wait() p.wait()
shutil.copy(tmp_output, output) shutil.copy(tmp_output, output)
os.unlink(tmp_output) os.unlink(tmp_output)