yoda/adapter/abstract.py
def execute(self, command, path=None):
        """Execute command with os.popen and return output."""
        logger = logging.getLogger(__name__)

        self.check_executable()
        logger.debug("Executing command `%s` (cwd: %s)" % (command, path))
        process = subprocess.Popen(
            command,
            shell=True,
            cwd=path,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE
        )
        stdout, stderr = process.communicate()
        exit_code = process.wait()

        if stdout:
            logger.info(stdout.decode("utf-8"))

        if stderr:
            if exit_code != 0:
                logger.error(stderr.decode("utf-8"))
            else:
                logger.info(stderr.decode("utf-8"))

        return process
def execute(self, command, path=None):
        """Execute command with os.popen and return output."""
        logger = logging.getLogger(__name__)

        self.check_executable()
        logger.debug("Executing command `%s` (cwd: %s)" % (command, path))
        process = subprocess.Popen(
            command,
            shell=True,
            cwd=path,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE
        )
        stdout, stderr = process.communicate()
        exit_code = process.wait()

        if stdout:
            logger.info(stdout.decode("utf-8"))

        if stderr:
            if exit_code != 0:
                logger.error(stderr.decode("utf-8"))
            else:
                logger.info(stderr.decode("utf-8"))

        return process
Execute command with os.popen and return output.