diff options
author | Jack Lloyd <[email protected]> | 2017-01-04 18:55:51 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-01-04 18:55:51 -0500 |
commit | 13451bdbc4a0fa360597a7b1e267c2d0b62847ae (patch) | |
tree | 71d9b64660605c1802340b4b8b14157427388fa2 /configure.py | |
parent | a0330350f7f43bddb4a41e2db87ed0b8e2c955b3 (diff) |
Wrap read of /proc/cpuinfo in try/catch block
Diffstat (limited to 'configure.py')
-rwxr-xr-x | configure.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/configure.py b/configure.py index f33356d6e..530900aad 100755 --- a/configure.py +++ b/configure.py @@ -1151,15 +1151,19 @@ def system_cpu_info(): cpu_info = [] - with open('/proc/cpuinfo') as f: - for line in f.readlines(): - if line.find(':') != -1: - (key,val) = [s.strip() for s in line.split(':')] - - # Different Linux arch use different names for this field in cpuinfo - if key in ["model name", "cpu model", "Processor"]: - cpu_info.append(val) - break + try: + with open('/proc/cpuinfo') as f: + for line in f.readlines(): + if line.find(':') != -1: + (key,val) = [s.strip() for s in line.split(':')] + + # Different Linux arch use different names for this field in cpuinfo + if key in ["model name", "cpu model", "Processor"]: + cpu_info.append(val) + break + + except IOError: + pass if platform.processor() != '': cpu_info.append(platform.processor()) |