|
|
|
@ -37,16 +37,27 @@ lang().setLanguage(sys.modules[__name__])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SignalInterrupt:
|
|
|
|
|
__interruptProcessObjs = []
|
|
|
|
|
__sigint = False
|
|
|
|
|
|
|
|
|
|
def setSignalInterrupt(self):
|
|
|
|
|
"""Handler "SIGINT"""
|
|
|
|
|
if SignalInterrupt.__sigint is False:
|
|
|
|
|
sys.stdout.write("\b\b")
|
|
|
|
|
# killed processes
|
|
|
|
|
while (SignalInterrupt.__interruptProcessObjs):
|
|
|
|
|
process = SignalInterrupt.__interruptProcessObjs.pop()
|
|
|
|
|
if hasattr(process, "pipe") and hasattr(process.pipe,"kill"):
|
|
|
|
|
process.pipe.kill()
|
|
|
|
|
SignalInterrupt.__sigint = True
|
|
|
|
|
|
|
|
|
|
def getSignalInterrupt(self):
|
|
|
|
|
return SignalInterrupt.__sigint
|
|
|
|
|
|
|
|
|
|
def addInterruptProcess(self, process):
|
|
|
|
|
SignalInterrupt.__interruptProcessObjs.append(process)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Spinner(threading.Thread):
|
|
|
|
|
stopSignal = threading.Event()
|
|
|
|
|
sequence= map(lambda x:x,iter("/-\\|"))
|
|
|
|
@ -407,6 +418,7 @@ class Distributive(object, SignalInterrupt):
|
|
|
|
|
try:
|
|
|
|
|
rsyncProcess = process("/usr/bin/rsync", "-a", "-x",
|
|
|
|
|
"%s/"%fromdir,"%s/"%todir,stderr=STDOUT)
|
|
|
|
|
self.addInterruptProcess(rsyncProcess)
|
|
|
|
|
res = rsyncProcess.success()
|
|
|
|
|
errmes = rsyncProcess.read()
|
|
|
|
|
except Exception,e:
|
|
|
|
|