mirror of
https://github.com/python/cpython.git
synced 2025-08-23 02:04:56 +00:00
gh-116401: Fix blocking os.fwalk() and shutil.rmtree() on opening a named pipe (GH-116421)
This commit is contained in:
parent
8332e85b2f
commit
aa7bcf284f
6 changed files with 113 additions and 8 deletions
|
@ -681,7 +681,7 @@ def _rmtree_safe_fd(topfd, path, onexc):
|
|||
continue
|
||||
if is_dir:
|
||||
try:
|
||||
dirfd = os.open(entry.name, os.O_RDONLY, dir_fd=topfd)
|
||||
dirfd = os.open(entry.name, os.O_RDONLY | os.O_NONBLOCK, dir_fd=topfd)
|
||||
dirfd_closed = False
|
||||
except FileNotFoundError:
|
||||
continue
|
||||
|
@ -786,7 +786,7 @@ def rmtree(path, ignore_errors=False, onerror=None, *, onexc=None, dir_fd=None):
|
|||
onexc(os.lstat, path, err)
|
||||
return
|
||||
try:
|
||||
fd = os.open(path, os.O_RDONLY, dir_fd=dir_fd)
|
||||
fd = os.open(path, os.O_RDONLY | os.O_NONBLOCK, dir_fd=dir_fd)
|
||||
fd_closed = False
|
||||
except OSError as err:
|
||||
onexc(os.open, path, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue