MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / run_cmd

Function run_cmd

tools/ci/bsp_buildings.py:28–50  ·  view source on GitHub ↗

run command and return output and result.

(cmd, output_info=True)

Source from the content-addressed store, hash-verified

26
27
28def run_cmd(cmd, output_info=True):
29 """
30 run command and return output and result.
31 """
32 print('\033[1;32m' + cmd + '\033[0m')
33
34 output_str_list = []
35 res = 0
36
37 if output_info:
38 res = os.system(cmd + " > output.txt 2>&1")
39 else:
40 res = os.system(cmd + " > /dev/null 2>output.txt")
41
42 with open("output.txt", "r") as file:
43 output_str_list = file.readlines()
44
45 for line in output_str_list:
46 print(line, end='')
47
48 os.remove("output.txt")
49
50 return output_str_list, res
51
52
53def build_bsp(bsp, scons_args='',name='default', pre_build_commands=None, post_build_command=None,build_check_result = None,bsp_build_env=None):

Callers 1

build_bspFunction · 0.70

Calls 1

openFunction · 0.50

Tested by

no test coverage detected