Issue #27241: Catch exception when running pstats as main.
This commit is contained in:
parent
7bfbd1d3c5
commit
e12a68be35
|
@ -574,7 +574,10 @@ if __name__ == '__main__':
|
|||
|
||||
def do_add(self, line):
|
||||
if self.stats:
|
||||
self.stats.add(line)
|
||||
try:
|
||||
self.stats.add(line)
|
||||
except IOError as e:
|
||||
print("Failed to load statistics for %s: %s" % (line, e), file=self.stream)
|
||||
else:
|
||||
print("No statistics object is loaded.", file=self.stream)
|
||||
return 0
|
||||
|
|
Loading…
Reference in New Issue