From a6ef9be16248e2a71f6d84b66108178606ce286f Mon Sep 17 00:00:00 2001 From: bgme Date: Tue, 15 Aug 2023 02:22:39 +0800 Subject: [PATCH] fix bug on move file over filesystem raise OSError --- archrepo2/repomon.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/archrepo2/repomon.py b/archrepo2/repomon.py index 405f00c..bbd1c6a 100755 --- a/archrepo2/repomon.py +++ b/archrepo2/repomon.py @@ -10,6 +10,7 @@ import queue import logging import sqlite3 import socket +import shutil import time import hashlib from os.path import relpath @@ -331,7 +332,7 @@ class EventHandler(pyinotify.ProcessEvent): newd = os.path.join(base, act.arch) newpath = os.path.join(newd, file) if not same_existent_file(path, newpath): - os.rename(path, newpath) + shutil.move(path, newpath) act.path = newpath path = newpath @@ -601,4 +602,4 @@ class SpoolHandler(pyinotify.ProcessEvent): def dispatch(self, path): filename = os.path.basename(path) - os.rename(path, os.path.join(self.dstpath, filename)) + shutil.move(path, os.path.join(self.dstpath, filename))