From a37ffb1b28c5c051a7643f05333011d40119697f Mon Sep 17 00:00:00 2001 From: zyh Date: Thu, 17 May 2018 16:45:16 +0800 Subject: [PATCH] [Tools]fix GCC7 in MacOSX --- tools/gcc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/gcc.py b/tools/gcc.py index bfa0ca4173..b977f183f7 100644 --- a/tools/gcc.py +++ b/tools/gcc.py @@ -1,5 +1,6 @@ import os import re +import platform def GetGCCRoot(rtconfig): exec_path = rtconfig.EXEC_PATH @@ -59,7 +60,11 @@ def GCCResult(rtconfig, str): f.close() # '-fdirectives-only', - child = subprocess.Popen([gcc_cmd, '-E', '-P', '__tmp.c'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) + if(platform.system() == 'Windows'): + child = subprocess.Popen([gcc_cmd, '-E', '-P', '__tmp.c'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) + else: + child = subprocess.Popen(gcc_cmd + ' -E -P __tmp.c', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) + stdout, stderr = child.communicate() print(stdout)