about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-01-11 14:58:00 +0100
committerhut <hut@lavabit.com>2012-01-11 16:58:14 +0100
commit4904e06e6aa2278f96d9fd007c6ac3261f127f25 (patch)
tree89eafddf8ae9855109227703c8bb73a9d012ab36
parent907e3fde740f69b4ef9bc8fa4a7090512583baf7 (diff)
downloadranger-4904e06e6aa2278f96d9fd007c6ac3261f127f25.tar.gz
core.main: pipe the profiler stream to stderr
-rw-r--r--ranger/core/main.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/ranger/core/main.py b/ranger/core/main.py
index 1c2686bb..8458f928 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -127,7 +127,7 @@ def main():
 			profile = None
 			ranger.__fm = fm
 			cProfile.run('ranger.__fm.loop()', '/tmp/ranger_profile')
-			profile = pstats.Stats('/tmp/ranger_profile')
+			profile = pstats.Stats('/tmp/ranger_profile', stream=sys.stderr)
 		else:
 			fm.loop()
 	except Exception:
@@ -146,9 +146,7 @@ def main():
 		except (AttributeError, NameError):
 			pass
 		if ranger.arg.profile and profile:
-			stdout, sys.stdout = sys.stdout, sys.stderr
-			profile.strip_dirs().sort_stats('cumulative').print_callees(100)
-			sys.stdout = stdout
+			profile.strip_dirs().sort_stats('cumulative').print_callees()
 		if crash_traceback:
 			print("ranger version: %s, executed with python %s" %
 					(ranger.__version__, sys.version.split()[0]))