fix: Fehlerbehandlung für I/O-Operationen während des Kopiervorgangs verbessert und Versionsnummer auf 1.0.17 erhöht
This commit is contained in:
13
app.py
13
app.py
@@ -638,6 +638,7 @@ def do_copy(src_dev, dst_dev, cfg):
|
||||
dup_mode = cfg.get('duplicate_handling', 'skip')
|
||||
copied_pairs = [] # [(src, dst)] erfolgreich kopiert
|
||||
skipped = 0
|
||||
io_errors = 0
|
||||
|
||||
# ── Phase 1: Kopieren ──────────────────────────────────────────────
|
||||
for i, f in enumerate(files):
|
||||
@@ -672,10 +673,16 @@ def do_copy(src_dev, dst_dev, cfg):
|
||||
try:
|
||||
shutil.copy2(f, tmp_f) # Erst in Temp-Datei kopieren
|
||||
os.replace(str(tmp_f), str(dst_f)) # Dann atomar umbenennen
|
||||
except Exception:
|
||||
except OSError as copy_err:
|
||||
try: tmp_f.unlink(missing_ok=True)
|
||||
except Exception: pass
|
||||
raise
|
||||
io_errors += 1
|
||||
add_log(f'⚠ Fehler bei {f.name}: {copy_err}')
|
||||
with copy_lock:
|
||||
copy_state.update(done=i+1,
|
||||
progress=int((i+1)/total*100) if total else 100,
|
||||
current=str(f.name))
|
||||
continue
|
||||
copied_pairs.append((f, dst_f))
|
||||
|
||||
with copy_lock:
|
||||
@@ -694,6 +701,8 @@ def do_copy(src_dev, dst_dev, cfg):
|
||||
msg_parts = [f'{len(copied_pairs)} kopiert']
|
||||
if skipped:
|
||||
msg_parts.append(f'{skipped} übersprungen')
|
||||
if io_errors:
|
||||
msg_parts.append(f'{io_errors} Fehler (I/O)')
|
||||
|
||||
# ── Phase 2: Verifizieren ──────────────────────────────────────────
|
||||
verify_errors = 0
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.0.16
|
||||
1.0.17
|
||||
Reference in New Issue
Block a user