Handle broken pipe errors during test compile

This commit is contained in:
Kovid Goyal 2018-10-03 12:46:08 +05:30
parent 1fa66ca45d
commit 2637018b53
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -142,7 +142,10 @@ def get_sanitize_args(cc, ccver):
def test_compile(cc, *cflags, src=None):
src = src or 'int main(void) { return 0; }'
p = subprocess.Popen([cc] + list(cflags) + ['-x', 'c', '-o', os.devnull, '-'], stdin=subprocess.PIPE)
p.stdin.write(src.encode('utf-8')), p.stdin.close()
try:
p.stdin.write(src.encode('utf-8')), p.stdin.close()
except BrokenPipeError:
return False
return p.wait() == 0