|
@@ -84,10 +84,18 @@ def _ssh_base(destination, data_dir):
|
|
|
|
|
|
|
|
def _collect_ssh(destination, data_dir):
|
|
def _collect_ssh(destination, data_dir):
|
|
|
remote_dir = shlex.quote(destination.remote_path)
|
|
remote_dir = shlex.quote(destination.remote_path)
|
|
|
|
|
+ # find -printf n'est pas disponible sur tous les systèmes (BusyBox, BSD…)
|
|
|
|
|
+ # On utilise cd + find + stat avec fallback BSD pour la portabilité
|
|
|
|
|
+ remote_cmd = (
|
|
|
|
|
+ f"cd {remote_dir} && find . -maxdepth 1 -name '*.tar' -type f 2>/dev/null"
|
|
|
|
|
+ " | sed 's|^\\./||'"
|
|
|
|
|
+ " | while IFS= read -r f; do"
|
|
|
|
|
+ " s=$(stat -c%s \"$f\" 2>/dev/null || stat -f%z \"$f\" 2>/dev/null || echo 0);"
|
|
|
|
|
+ " printf '%s\\t%s\\n' \"$f\" \"$s\";"
|
|
|
|
|
+ " done; true"
|
|
|
|
|
+ )
|
|
|
result = subprocess.run(
|
|
result = subprocess.run(
|
|
|
- _ssh_base(destination, data_dir) + [
|
|
|
|
|
- f"find {remote_dir} -maxdepth 1 -name '*.tar' -printf '%f\\t%s\\n' 2>/dev/null || true"
|
|
|
|
|
- ],
|
|
|
|
|
|
|
+ _ssh_base(destination, data_dir) + [remote_cmd],
|
|
|
capture_output=True, text=True, timeout=20,
|
|
capture_output=True, text=True, timeout=20,
|
|
|
)
|
|
)
|
|
|
if result.returncode != 0:
|
|
if result.returncode != 0:
|