build.py: Change hung invocation to subprocess.Popen()

Pass an array to Popen(), shell=False, close_fds=True, stderr=None,
this fixes a hung zombie child.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2017-12-26 22:27:25 +00:00
commit 7bb67d062a

View file

@ -122,7 +122,8 @@ def calculate_order(order, modules, prereq_types):
def run_make(module, target):
global cur_project
cur_project=cur_project+1
make_cmd = "make " + target + " 2>&1"
#make_cmd = "make " + target + " 2>&1"
make_cmd = [ "make", target ]
path = find_proj_path_cached(module)
delim_len=120
delim='---- %d/%d: running %s in %s -' % (cur_project, len(order), make_cmd, path)
@ -130,7 +131,7 @@ def run_make(module, target):
print(',' + delim + ' >')
os.chdir(path)
p = subprocess.Popen(make_cmd, shell=True, stdout=subprocess.PIPE)
p = subprocess.Popen(make_cmd, shell=False, stdout=subprocess.PIPE, stderr=None, close_fds=True)
for line in iter(p.stdout.readline, ''):
sys.stdout.write('| ' + line) # avoid extra newlines from print()
sys.stdout.flush()