fga-eps-mds/2019.1-unbrake

View on GitHub
unbrake-api/unbrake_api/management/commands/_script.py

Summary

Maintainability
A
0 mins
Test Coverage
'''
General helper module for running scripts
'''

import os
from django.core.management import CommandError


def run_script(script, error_message=''):
    '''
    General function for running scripts
    '''
    return_code = os.system(script)

    if return_code:
        if not error_message:
            error_message = f'{script.split("/")[-1]} failed!'
        raise CommandError(error_message)