File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -302,7 +302,7 @@ def _rmtree_inner(path):
302302 try :
303303 mode = os .lstat (fullname ).st_mode
304304 except OSError as exc :
305- print ("os_helper .rmtree(): os.lstat(%r) failed with %s"
305+ print ("support .rmtree(): os.lstat(%r) failed with %s"
306306 % (fullname , exc ),
307307 file = sys .__stderr__ )
308308 mode = 0
@@ -479,6 +479,17 @@ def create_empty_file(filename):
479479 os .close (fd )
480480
481481
482+ @contextlib .contextmanager
483+ def open_dir_fd (path ):
484+ """Open a file descriptor to a directory."""
485+ assert os .path .isdir (path )
486+ dir_fd = os .open (path , os .O_RDONLY )
487+ try :
488+ yield dir_fd
489+ finally :
490+ os .close (dir_fd )
491+
492+
482493def fs_is_case_insensitive (directory ):
483494 """Detects if the file system for the specified directory
484495 is case-insensitive."""
You can’t perform that action at this time.
0 commit comments