diff options
author | Zhehao Mao <zhehao.mao@gmail.com> | 2012-06-25 09:44:33 -0400 |
---|---|---|
committer | Zhehao Mao <zhehao.mao@gmail.com> | 2012-06-25 09:45:56 -0400 |
commit | 3a164730310cc2d4e4877cded56759f819eee980 (patch) | |
tree | ff0c2ba3fbdd66d0346ac0788e8b688baec5d15f /buildscripts | |
parent | 1842db9d10f977b6fa2115c16df0952ab08b68e3 (diff) | |
download | mongo-3a164730310cc2d4e4877cded56759f819eee980.tar.gz |
make sure file exists before getsize in aggregate_tracefiles.py
Diffstat (limited to 'buildscripts')
-rw-r--r-- | buildscripts/aggregate_tracefiles.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/buildscripts/aggregate_tracefiles.py b/buildscripts/aggregate_tracefiles.py index e2652382601..e4f74b5b4c4 100644 --- a/buildscripts/aggregate_tracefiles.py +++ b/buildscripts/aggregate_tracefiles.py @@ -19,6 +19,10 @@ def aggregate(inputs, output): return subprocess.call(args) +def getfilesize(path): + if not os.path.isfile(path): + return 0 + return os.path.getsize(path) def main (): inputs = [] @@ -34,12 +38,12 @@ def main (): name, ext = os.path.splitext(path) if ext == '.info': - if os.path.getsize(path) > 0: + if getfilesize(path) > 0: inputs.append(path) elif ext == '.txt': inputs += [line.strip() for line in open(path) - if os.path.getsize(line.strip()) > 0] + if getfilesize(line.strip()) > 0] else: return "unrecognized file type" |