Mercurial > cpython-lru_cache-weakref
diff Tools/scripts/dutree.py @ 10484:500f8ec9ded1 legacy-trunk
During display, if EPIPE is raised, it's probably because a pager was
killed. Discard the error in that case, but propogate it otherwise.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Fri, 26 Mar 1999 22:36:00 +0000 |
| parents | f057751cef61 |
| children | 5393ce5207c7 |
line wrap: on
line diff
--- a/Tools/scripts/dutree.py Fri Mar 26 21:48:59 1999 +0000 +++ b/Tools/scripts/dutree.py Fri Mar 26 22:36:00 1999 +0000 @@ -1,7 +1,7 @@ #! /usr/bin/env python # Format du output in a tree shape -import os, string, sys +import os, string, sys, errno def main(): p = os.popen('du ' + string.join(sys.argv[1:]), 'r') @@ -16,7 +16,11 @@ if comps[0] == '': comps[0] = '/' if comps[len(comps)-1] == '': del comps[len(comps)-1] total, d = store(size, comps, total, d) - display(total, d) + try: + display(total, d) + except IOError, e: + if e.errno != errno.EPIPE: + raise def store(size, comps, total, d): if comps == []: @@ -52,4 +56,5 @@ if d.has_key(key): show(tsub, d[key][1], psub) -main() +if __name__ == "__main__": + main()
