def run_script()

in plugins/asfrun.py [0:0]


def run_script(pel_ob, command_source, env=False):
    commands = pel_ob.settings.get(command_source)
    if commands:
        print(f'-----\nasfrun {command_source}')
        if env:
            # copy the pelican environment into the OS env
            my_env = os.environ.copy()
            for k, v in sorted(pel_ob.settings.items()):
                if k != 'ASF_DATA': # rather large; not needed
                    my_env['PELICAN_'+k] = str(v)
        else:
            my_env = None
        for command in commands:
            print(f'-----\n{command}')
            args = shlex.split(command)
            print(args)
            with os_run(args, my_env) as s:
                for line in s.stdout:
                    line = line.strip()
                    print(f'{line}')