Newer
Older
def and_(iter):
"""Do an and logic condition over the iterable element.
:param iterable iter: meat for condition
"""
for i in iter:
if not i:
return False
return True
def subproc_call(args, stdin=None):
"""
:param args: arguments for subprocess call
:param stdin: stdin data as string
"""
proc = subprocess.Popen(args, bufsize=4096, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
result, _ = proc.communicate(stdin)
if proc.returncode != 0:
raise subprocess.CalledProcessError(proc.returncode,
'Error while executing command')
return result