diff --git a/datalad_next/iter_collections/gitworktree.py b/datalad_next/iter_collections/gitworktree.py index a2dee1b58..e2448f1cd 100644 --- a/datalad_next/iter_collections/gitworktree.py +++ b/datalad_next/iter_collections/gitworktree.py @@ -23,10 +23,9 @@ from datalad_next.runners import ( DEVNULL, LineSplitter, - ThreadedRunner, StdOutCaptureGeneratorProtocol, ) - +from datalad_next.runners.run import run from .utils import ( FileSystemItem, FileSystemItemType, @@ -250,8 +249,7 @@ def _lsfiles_line2props( def _git_ls_files(path, *args): - # we use a plain runner to avoid the overhead of a GitRepo instance - runner = ThreadedRunner( + with run( cmd=[ 'git', 'ls-files', # we rely on zero-byte splitting below @@ -261,12 +259,12 @@ def _git_ls_files(path, *args): ], protocol_class=StdOutCaptureGeneratorProtocol, stdin=DEVNULL, - # run in the directory we want info on cwd=path, - ) - line_splitter = LineSplitter('\0', keep_ends=False) - # for each command output chunk received by the runner - for content in runner.run(): - # for each zerobyte-delimited "line" in the output - for line in line_splitter.process(content.decode('utf-8')): - yield line + ) as r: + # we use a plain runner to avoid the overhead of a GitRepo instance + line_splitter = LineSplitter('\0', keep_ends=False) + # for each command output chunk received by the runner + for content in r: + # for each zerobyte-delimited "line" in the output + for line in line_splitter.process(content.decode('utf-8')): + yield line