(self, args, name)
return status
Run an external command and pipe stdout / stderr to log
Run an external command and pipe stdout / stderr to log
Run an external command and pipe stdout / stderr to log
def runCommand(self, args, name):
        """Run an external command and pipe stdout / stderr to log"""
        status = subprocess.run(args,
                                universal_newlines=True,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.PIPE)

        if status.returncode != 0:
            logging.error("Error when running '%s'", name)
            logging.error("Original command: %s", str.join(" ", args))
        else:
            logging.info("Running '%s' successfully.", name)

        if status.stdout != None and status.stdout.strip() != "":
            logging.info(status.stdout)

        if status.stderr != None and status.stderr.strip() != "":
            logging.info(status.stderr)

        return status
def runCommand ( self , args , name ) : status = subprocess . run ( args , universal_newlines = True , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) if status . returncode != 0 : logging . error ( "Error when running '%s'" , name ) logging . error ( "Original command: %s" , str . join ( " " , args ) ) else : logging . info ( "Running '%s' successfully." , name ) if status . stdout != None and status . stdout . strip ( ) != "" : logging . info ( status . stdout ) if status . stderr != None and status . stderr . strip ( ) != "" : logging . info ( status . stderr ) return status