def shell_cmd(args, cwd=BASE_DIR):
	if not isinstance(args, (list, tuple)):
		args = [args]
	ps = Popen(args, shell=True, cwd=cwd, stdout=PIPE, stderr=PIPE,
						 close_fds=True)
	stdout, stderr = ps.communicate()
	if ps.returncode != 0:
		if stderr:
			stderr = stderr.strip()
		raise IOError('Shell command %s failed (exit status %r): %s' %\
			(args, ps.returncode, stderr))
	return stdout.strip()
Returns stdout as string or None on failure
dataset/ETHPy150Open rsms/smisk/setup.py/shell_cmd