Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent double '//' in case of root folder and increase streaming limit #54

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions rsync_time_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,14 @@ async def async_run_cmd(
f"{ssh.cmd} '{cmd}'",
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
limit=2**19, # default is 2**16 = 64 KiB
)
else:
process = await asyncio.create_subprocess_shell(
cmd,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
limit=2**19, # default is 2**16 = 64 KiB
)

# Should not be None because of asyncio.subprocess.PIPE
Expand Down Expand Up @@ -757,9 +759,15 @@ def start_backup(
if ssh is not None:
src_folder = f"{ssh.src_folder_prefix}{src_folder}"
dest = f"{ssh.dest_folder_prefix}{dest}"

if src_folder != "/":
src_folder = f"{src_folder}/"
if dest != "/":
dest = f"{dest}/"

log_info(style("Starting backup...", "yellow"))
log_info(f"From: {style(src_folder, bold=True)}/")
log_info(f"To: {style(dest, bold=True)}/")
log_info(f"From: {style(src_folder, bold=True)}")
log_info(f"To: {style(dest, bold=True)}")

cmd = "rsync"
if ssh is not None:
Expand All @@ -772,7 +780,7 @@ def start_backup(
cmd = f"{cmd} --exclude-from '{exclusion_file}'"

cmd = f"{cmd} {link_dest_option}"
cmd = f"{cmd} -- '{src_folder}/' '{dest}/'"
cmd = f"{cmd} -- '{src_folder}' '{dest}'"

log_info(style("Running command:", bold=True))
log_info(style(cmd, "green"))
Expand Down
Loading