#! /usr/bin/python3 # Last edited on 2025-08-07 02:27:07 by stolfi # python3 functions that check args and print error messages. # To be imported by other python scripts. import sys, os, subprocess; def run_command(command): result = subprocess.run(command, text = True, timeout = None) if result.returncode != 0: print(result.stderr) print(result.stdout) assert False, f"** {command[0]} failed - returned status = {result}" return # ...................................................................... def bash(cmd): # Execute the string {cmd} with "/bin/bash". result = subprocess.run([ cmd ], shell = True, executable = "/bin/bash") if result.returncode != 0: print(result.stderr) print(result.stdout) assert False, f"** {cmd} failed - returned status = {result}" # ......................................................................