MCPcopy Index your code
hub / github.com/microsoft/BitNet / run_command

Function run_command

setup_env.py:92–107  ·  view source on GitHub ↗

Run a system command and ensure it succeeds.

(command, shell=False, log_step=None)

Source from the content-addressed store, hash-verified

90 return os.path.basename(os.path.normpath(args.model_dir))
91
92def run_command(command, shell=False, log_step=None):
93 """Run a system command and ensure it succeeds."""
94 if log_step:
95 log_file = os.path.join(args.log_dir, log_step + ".log")
96 with open(log_file, "w") as f:
97 try:
98 subprocess.run(command, shell=shell, check=True, stdout=f, stderr=f)
99 except subprocess.CalledProcessError as e:
100 logging.error(f"Error occurred while running command: {e}, check details in {log_file}")
101 sys.exit(1)
102 else:
103 try:
104 subprocess.run(command, shell=shell, check=True)
105 except subprocess.CalledProcessError as e:
106 logging.error(f"Error occurred while running command: {e}")
107 sys.exit(1)
108
109def prepare_model():
110 _, arch = system_info()

Callers 4

prepare_modelFunction · 0.70
setup_ggufFunction · 0.70
gen_codeFunction · 0.70
compileFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected