INNER CODE UNIT · Python

exec

biowasm/biowasm · bin/compile.py:36

def exec(cmd):
	"""
	Execute a Bash command or just print it on screen if dry run enabled
	"""
	cmd_dry = f"{COLOR_GREEN}{'    ' * LEVEL}{cmd}{COLOR_OFF}"
	print(cmd_dry)

	if not args.dry_run:
		# Stream output to screen as we get it
		with subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, universal_newlines=True) as p:
			for line in p.stdout:
				print(line, end='')
		if p.returncode != 0:
			print("Return code not 0: ", subprocess.CalledProcessError(p.returncode, p.args))


def get_file_contents(path):
	"""

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…