~edwargix/git.sr.ht

eb75b78c6c4e63ac89b54a1dd67f1881522ad8a0 — Drew DeVault 6 years ago 791b8df
Don't capture stderr/stdout of git subprocesses

Apparently subprocess is leaky

https://bugs.python.org/issue28165
1 files changed, 3 insertions(+), 4 deletions(-)

M gitsrht/blueprints/repo.py
M gitsrht/blueprints/repo.py => gitsrht/blueprints/repo.py +3 -4
@@ 2,6 2,7 @@ import binascii
import os
import pygit2
import pygments
import sys
import subprocess
from datetime import datetime, timedelta
from jinja2 import Markup


@@ 203,7 204,7 @@ def archive(owner, repo, ref):
        ]
        print(args)
        subp = subprocess.run(args, timeout=30,
                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
                stdout=sys.stdout, stderr=sys.stderr)
    except:
        try:
            os.unlink(path)


@@ 212,7 213,6 @@ def archive(owner, repo, ref):
        raise

    if subp.returncode != 0:
        print(subp.stdout, subp.stderr)
        try:
            os.unlink(path)
        except:


@@ 325,9 325,8 @@ def patch(owner, repo, ref):
        "format-patch",
        "--stdout", "-1",
        ref
    ], timeout=10, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    ], timeout=10, stdout=sys.stdout, stderr=sys.stderr)
    if subp.returncode != 0:
        print(subp.stdout, subp.stderr)
        return "Error preparing patch", 500
    return Response(subp.stdout, mimetype='text/plain')