cls_cmd.py: local copy: don't copy if src/tgt identical

This commit is contained in:
Robert Schmidt
2024-09-28 12:45:34 +02:00
parent f21b5d2ef4
commit 0d63861bf1
+2
View File
@@ -129,6 +129,8 @@ class LocalCmd(Cmd):
def copyin(self, src, tgt, recursive=False):
if src[0] != '/' or tgt[0] != '/':
raise Exception(f'support only absolute file paths (src {src} tgt {tgt})!')
if src == tgt:
return # nothing to copy, file is already where it should go
opt = '-r' if recursive else ''
return self.run(f'cp {opt} {src} {tgt}').returncode == 0