From 2637018b53f67f7f318c58606681c9fd1a05746d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 3 Oct 2018 12:46:08 +0530 Subject: [PATCH] Handle broken pipe errors during test compile --- setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 738873eb4..670327e09 100755 --- a/setup.py +++ b/setup.py @@ -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