Skip to content

Commit 14d9452

Browse files
committed
Replaced 'procrunner' with 'subprocess'
Co-authored by: stephen-riggs <[email protected]>
1 parent 72e0791 commit 14d9452

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/murfey/client/rsync.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
from typing import Callable, List, NamedTuple
1919
from urllib.parse import ParseResult
2020

21-
import procrunner
22-
2321
from murfey.client.tui.status_bar import StatusBar
2422
from murfey.util import Observer
2523

@@ -433,28 +431,29 @@ def parse_stderr(line: str):
433431
result: subprocess.CompletedProcess | None = None
434432
success = True
435433
if rsync_stdin:
436-
result = procrunner.run(
434+
result = subprocess.run(
437435
rsync_cmd,
438-
callback_stdout=parse_stdout,
439-
callback_stderr=parse_stderr,
440-
working_directory=str(self._basepath),
441-
stdin=rsync_stdin,
442-
print_stdout=False,
443-
print_stderr=False,
436+
cwd=str(self._basepath),
437+
capture_output=True,
438+
input=rsync_stdin,
444439
)
445-
success = result.returncode == 0 if result else False
440+
for stdout_line in result.stdout.decode("utf8", "replace").split("\n"):
441+
parse_stdout(stdout_line)
442+
for stderr_line in result.stderr.decode("utf8", "replace").split("\n"):
443+
parse_stderr(stderr_line)
444+
success = result.returncode == 0
446445

447446
if rsync_stdin_remove:
448447
rsync_cmd.insert(-2, "--remove-source-files")
449-
result = procrunner.run(
448+
result = subprocess.run(
450449
rsync_cmd,
451-
callback_stdout=parse_stdout,
452-
callback_stderr=parse_stderr,
453-
working_directory=str(self._basepath),
454-
stdin=rsync_stdin_remove,
455-
print_stdout=False,
456-
print_stderr=False,
450+
cwd=str(self._basepath),
451+
input=rsync_stdin_remove,
457452
)
453+
for stdout_line in result.stdout.decode("utf8", "replace").split("\n"):
454+
parse_stdout(stdout_line)
455+
for stderr_line in result.stderr.decode("utf8", "replace").split("\n"):
456+
parse_stderr(stderr_line)
458457

459458
if success:
460459
success = result.returncode == 0 if result else False

0 commit comments

Comments
 (0)