Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
fix(subprocess): close stdout and stderr to avoid memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
felix committed Sep 20, 2019
1 parent 205962f commit 780aad0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gnes/preprocessor/io_utils/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def run_command_async(cmd_args,
cmd_args,
stdin=stdin_stream,
stdout=stdout_stream,
stderr=stderr_stream)
stderr=stderr_stream,
close_fds=True)


def wait(process):
Expand Down Expand Up @@ -76,4 +77,10 @@ def run_command(cmd_args,

if retcode:
raise Exception('ffmpeg error: %s' % stderr)

if proc.stdout is not None:
proc.stdout.close()
if proc.stderr is not None:
proc.stderr.close()

return stdout, stderr

0 comments on commit 780aad0

Please sign in to comment.