def run_process()

in AWSConfig/AWS-Config-OPA/lambda_sources/function/opa_lambda.py [0:0]


def run_process(command):
    try:
        process = subprocess.run(
            command,
            capture_output=True,
            shell=True,
            encoding='utf-8'
        )
    except BrokenPipeError as e:
        logger.error('Process failed with {}'.format(e))
        raise
    except Exception as e:
        logger.error('Process failed with {}'.format(e))
        raise
    else:
        output = json.loads(process.stdout)
        logger.debug('Shell command stdout: {}'.format(output))
        return output