This commit is contained in:
a 2024-08-08 22:16:53 +02:00
parent 925da0e155
commit c5c7864563
3 changed files with 2 additions and 14 deletions

View file

@ -257,11 +257,6 @@ class CommandPipeline:
if hasattr(stdout, "buffer"):
stdout = stdout.buffer
if stdout is not None and not isinstance(stdout, self.nonblocking):
# try:
# fn = stdout.fileno()
# except:
# fn=0
# print('NonBlockingFDReader', spec.alias, spec.cmd, stdout, fn, file=sys.__stdout__)
stdout = NonBlockingFDReader(stdout.fileno(), timeout=timeout)
if (
not stdout
@ -394,7 +389,6 @@ class CommandPipeline:
# write to stdout line ASAP, if needed
if stream:
if stdout_has_buffer:
# self._std_is_binary
buf_mode = getattr(sys.stdout.buffer, "mode", None)
if (buf_mode and "b" in buf_mode) or getattr(
sys.stdout.buffer, "_std_is_binary", False

View file

@ -441,6 +441,7 @@ class ProcProxyThread(threading.Thread):
# stdout
if self.c2pwrite != -1:
if xt.ON_WINDOWS:
# This split was made during solving #5645. We need more eyes to improve this logic for Windows.
open_stdout = open(self.c2pwrite, "wb", -1)
else:
open_stdout = open(self.c2pwrite, "wb", -1) if isinstance(self.stdout, int) or self.stdout is None else self.stdout
@ -456,6 +457,7 @@ class ProcProxyThread(threading.Thread):
sp_stderr = sp_stdout
elif self.errwrite != -1:
if xt.ON_WINDOWS:
# This split was made during solving #5645. We need more eyes to improve this logic for Windows.
open_stderr = open(self.errwrite, "wb", -1)
else:
open_stderr = open(self.errwrite, "wb", -1) if isinstance(self.stderr, int) or self.stderr is None else self.stderr
@ -527,13 +529,7 @@ class ProcProxyThread(threading.Thread):
handles = [self.stdout, self.stderr]
else:
handles = [sp_stdout, sp_stderr]
# # if self.stdout:
# # print('Close', self.stdout, self.stdout.fileno(), file=sys.__stdout__)
for handle in handles:
# if isinstance(
# getattr(handle, "name", None), str
# ) and handle.name.startswith("/"):
# continue
safe_fdclose(handle, cache=self._closed_handle_cache)
def _wait_and_getattr(self, name):

View file

@ -415,9 +415,7 @@ def safe_fdclose(handle, cache=None):
pass
else:
try:
# print(f'close {handle}')
handle.close()
# print(f'/close {handle}')
except OSError:
status = False
if cache is not None: