Move get_platform_cmd_prefix into util.py (#4495)

get_platform_cmd_prefix implement multiple times in multiple function.
Also add function get_python_cmd_prefix, call to python script always
add python command so that on windows, the python script doesn't have
executable permission also can be called.

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
This commit is contained in:
Yonggang Luo
2021-02-04 20:23:57 +08:00
committed by GitHub
parent 9db4ec7d77
commit 4bb9e2b878
3 changed files with 24 additions and 18 deletions
+11
View File
@@ -65,3 +65,14 @@ def print_test_result(tested, total, is_passed, passed_string, test_path, is_sna
color = TERM_GREEN if is_passed else TERM_RED
print("[%4d/%4d] %s%s: %s%s%s" % (tested, total, color, passed_string, test_path, snapshot_string, TERM_NORMAL))
def get_platform_cmd_prefix():
if sys.platform == 'win32':
return ['cmd', '/S', '/C']
return []
def get_python_cmd_prefix():
# python script doesn't have execute permission on github actions windows runner
return get_platform_cmd_prefix() + [sys.executable or 'python']