dda-devops-build/src/main/python/ddadevops/python_util.py

13 lines
336 B
Python
Raw Normal View History

2019-09-06 16:00:15 +00:00
from subprocess import check_output
import sys
2020-03-04 16:31:54 +00:00
def execute(cmd, shell=False):
2019-09-06 16:00:15 +00:00
if sys.version_info.major == 3:
2020-03-04 16:31:54 +00:00
output = check_output(cmd, encoding='UTF-8', shell=shell)
2019-09-06 16:00:15 +00:00
else:
2020-03-04 16:31:54 +00:00
output = check_output(cmd, shell=shell)
return output.rstrip()
2020-03-03 17:30:17 +00:00
def filter_none(list):
return [x for x in list if x is not None]