diff --git a/pyshell/__init__.py b/pyshell/__init__.py index 8d44b52..4834bf7 100644 --- a/pyshell/__init__.py +++ b/pyshell/__init__.py @@ -3,6 +3,6 @@ __author__ = 'volitank' __license__ = 'GPLv3' __copyright__ = '2021 volitank' -__version__ = '1.0.0a4' +__version__ = '1.0.0a5' from .pyshell import pyshell, DEFAULT, DEVNULL, PIPE, STDOUT diff --git a/pyshell/pyshell.py b/pyshell/pyshell.py index 5fe8ee9..2c03a7d 100644 --- a/pyshell/pyshell.py +++ b/pyshell/pyshell.py @@ -21,6 +21,7 @@ import builtins import sys from pathlib import Path +from copy import deepcopy from inspect import getouterframes, currentframe from subprocess import Popen, CalledProcessError, TimeoutExpired, SubprocessError, CompletedProcess, _USE_POSIX_SPAWN @@ -294,10 +295,11 @@ def __call__(self, *args, commands = [name] # Check kwargs to see if an alias was set # If it was set our commands to that + if self.alias is not None: if self.alias.get(name): - commands = self.alias.get(name) - + commands = deepcopy(self.alias.get(name)) + # Now that possible aliases are set, we can append our arguments for arg in args: commands.append(arg) @@ -306,6 +308,7 @@ def __call__(self, *args, # This block says to error if we're not using the shell and we can't find the command. # But if we're using the shell then send it anyway. I'm not sure why I did this. # Maybe we should just send it no matter what? + if kwargs.get('shell') is None and self.kwargs.get('shell') is None: if shutil.which(name) is not None or self.alias.get(name) is not None: self.run( commands, @@ -321,7 +324,7 @@ def __call__(self, *args, logfile=logfile, timeout=timeout, **kwargs) return self.process - + def run(self, *popenargs, input=None, capture_output=False, check=False, logfile=None, timeout=None, **kwargs): diff --git a/setup.py b/setup.py index 85c478a..243dfa5 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ # Always prefer setuptools over distutils -from setuptools import setup, find_packages +from setuptools import setup from pathlib import Path import pyshell # Define the directory that setup.py is in