view clwapp/utils.py @ 7:a0816f433861 default tip

py3
author Jeff Hammel <k0scist@gmail.com>
date Tue, 24 Nov 2020 12:56:21 -0800
parents 196f241286f7
children
line wrap: on
line source

import subprocess

def shargs(args):
    process = subprocess.Popen('for arg in %s; do echo $arg; done' % args,
                               shell=True, stdout=subprocess.PIPE)
    output = process.communicate()[0]
    output = output.decode("utf-8")
    output = output.strip() # last line will be blank
    return output.split('\n')