capture: remove unused FDCapture tmpfile argument

This commit is contained in:
Ran Benita 2020-04-15 16:24:07 +03:00
parent 2695b41df3
commit 02c95ea624
1 changed files with 9 additions and 12 deletions

View File

@ -506,7 +506,7 @@ class FDCaptureBinary:
EMPTY_BUFFER = b""
_state = None
def __init__(self, targetfd, tmpfile=None):
def __init__(self, targetfd):
self.targetfd = targetfd
try:
@ -530,22 +530,19 @@ class FDCaptureBinary:
self.targetfd_save = os.dup(targetfd)
if targetfd == 0:
assert not tmpfile, "cannot set tmpfile with stdin"
tmpfile = open(os.devnull)
self.tmpfile = open(os.devnull)
self.syscapture = SysCapture(targetfd)
else:
if tmpfile is None:
tmpfile = EncodedFile(
TemporaryFile(buffering=0),
encoding="utf-8",
errors="replace",
write_through=True,
)
self.tmpfile = EncodedFile(
TemporaryFile(buffering=0),
encoding="utf-8",
errors="replace",
write_through=True,
)
if targetfd in patchsysdict:
self.syscapture = SysCapture(targetfd, tmpfile)
self.syscapture = SysCapture(targetfd, self.tmpfile)
else:
self.syscapture = NoCapture()
self.tmpfile = tmpfile
def __repr__(self):
return "<{} {} oldfd={} _state={!r} tmpfile={!r}>".format(