checkrestart: Properly error-out when calling pmap fails
Nicolas Braud-Santoni
6 years ago
363 | 363 | def procfilescheck(blacklist = None, excludepidlist = None): |
364 | 364 | # Use the underlying /proc file system to determine processes that |
365 | 365 | # are using deleted files |
366 | from subprocess import check_output | |
366 | 367 | processes = {} |
367 | 368 | # Get a list of running processes |
368 | 369 | pids = [pid for pid in os.listdir('/proc') if pid.isdigit()] |
385 | 386 | continue |
386 | 387 | |
387 | 388 | # Get the list of memory mapped files using system pmap |
388 | for output in os.popen('pmap ' + pid).readlines(): | |
389 | for output in check_output(['pmap', pid]).splitlines(): | |
389 | 390 | data = re.split('\s+', output.strip('\n'), 3) |
390 | 391 | if len(data) == 4: |
391 | 392 | f = data[3] |