Thread safety, cleaning

This commit is contained in:
jpic
2020-02-15 16:59:36 +01:00
parent 3afc739a1e
commit c96d2494d2
7 changed files with 60 additions and 27 deletions
+6 -1
View File
@@ -14,6 +14,7 @@ class Actions(list):
self.append(action)
def append(self, value):
value = copy.deepcopy(value)
value.parent = self.owner
value.status = 'pending'
super().append(value)
@@ -21,7 +22,7 @@ class Actions(list):
class Script(Action):
root = '/'
contextualize = ['shargs', 'exec', 'rexec', 'env', 'which']
contextualize = ['shargs', 'exec', 'rexec', 'env', 'which', 'copy']
def __init__(self, *actions, **kwargs):
super().__init__(**kwargs)
@@ -77,3 +78,7 @@ class Script(Action):
p = os.path.join(self.root, path[1:], c)
if os.path.exists(p):
return p[len(str(self.root)):]
async def copy(self, *args):
args = ['cp', '-ra'] + list(args)
return await self.exec(*args)