diff --git a/shlax/actions/run.py b/shlax/actions/run.py index 21199ff..83ea901 100644 --- a/shlax/actions/run.py +++ b/shlax/actions/run.py @@ -3,4 +3,4 @@ from .base import Action class Run(Action): async def call(self, *args, **kwargs): - return (await self.exec(*self.args, **self.kwargs)) + return await self.exec(*self.args, **self.kwargs) diff --git a/shlax/strategies/script.py b/shlax/strategies/script.py index c2c6a7b..24ac09b 100644 --- a/shlax/strategies/script.py +++ b/shlax/strategies/script.py @@ -21,7 +21,6 @@ class Actions(list): class Script(Action): - root = '/' contextualize = ['shargs', 'exec', 'rexec', 'env', 'which', 'copy'] def __init__(self, *actions, **kwargs): diff --git a/shlax/targets/buildah.py b/shlax/targets/buildah.py index fc6205a..df55e92 100644 --- a/shlax/targets/buildah.py +++ b/shlax/targets/buildah.py @@ -61,10 +61,18 @@ class Buildah(Localhost): dst = args[-1] await self.mkdir(dst) - args = ['buildah', 'copy', self.ctr] + list( - [str(a) for a in src] - ) + [str(dst)] - return await self.exec(*args, buildah=False) + procs = [] + for s in src: + if Path(s).is_dir(): + target = self.mnt / s + if not target.exists(): + await self.mkdir(target) + args = ['buildah', 'copy', self.ctr, s, Path(dst) / s] + else: + args = ['buildah', 'copy', self.ctr, s, dst] + procs.append(self.exec(*args, buildah=False)) + + return await asyncio.gather(*procs) async def mount(self, src, dst): """Mount a host directory into the container.""" @@ -87,7 +95,7 @@ class Buildah(Localhost): return p[len(str(self.mnt)):] def is_wrapper(self): - return ( + return not ( Proc.test or os.getuid() == 0 or getattr(self.parent, 'parent', None) diff --git a/shlax/targets/localhost.py b/shlax/targets/localhost.py index d945fce..892383f 100644 --- a/shlax/targets/localhost.py +++ b/shlax/targets/localhost.py @@ -30,6 +30,7 @@ class Localhost(Script): async def exec(self, *args, **kwargs): kwargs.setdefault('debug', self.call_kwargs.get('debug', False)) + kwargs.setdefault('output', self.output) args, kwargs = self.shargs(*args, **kwargs) proc = await Proc(*args, **kwargs)() if kwargs.get('wait', True):