From fb98be198f155a6fa8dd35e80d920ef33404feaa Mon Sep 17 00:00:00 2001 From: Guillaume Chazarain Date: Sat, 31 May 2008 21:50:42 +0200 Subject: [PATCH] Revert "Detect leaked gsh processes" This reverts commit 64e50f55a7742bbfae443f6a69ac96f2b335ce38. Conflicts: tests/gsh_tests.py We are actually leaking ssh and sshd processes, not gsh --- tests/gsh_tests.py | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/tests/gsh_tests.py b/tests/gsh_tests.py index dab3e6d..af0c4a1 100755 --- a/tests/gsh_tests.py +++ b/tests/gsh_tests.py @@ -18,19 +18,15 @@ # # Copyright (c) 2007, 2008 Guillaume Chazarain -import errno import os import unittest -import shutil import sys import optparse import pexpect import subprocess -import traceback import coverage -PID_DIR = '.gsh_pids' TESTS = unittest.TestSuite() def iter_over_all_tests(): @@ -87,30 +83,10 @@ def end_coverage(): # Prevent the atexit.register(the_coverage.save) from recreating the files coverage.the_coverage.usecache = coverage.the_coverage.cache = None -def cleanup_gsh_pids(): - for pid in map(int, os.listdir(PID_DIR)): - try: - os.kill(pid, 0) - except OSError: - # Good, process already killed - pass - else: - print '--------' - print 'gsh process %d leaked, launched at:' % pid - stack_path = '%s/%d' % (PID_DIR, pid) - subprocess.Popen(args=['cat', stack_path]).communicate() - shutil.rmtree(PID_DIR) - def main(): options, args = parse_cmdline() if options.coverage: remove_coverage_files() - try: - shutil.rmtree(PID_DIR) - except OSError, e: - if e.errno != errno.ENOENT: - raise - os.mkdir(PID_DIR) if args: import_specified_tests(args) else: @@ -118,12 +94,8 @@ def main(): try: unittest.main(argv=[sys.argv[0], '-v'], defaultTest='TESTS') finally: - try: - cleanup_gsh_pids() - finally: - if options.coverage: - end_coverage() - + if options.coverage: + end_coverage() class non_interactive_spawn(pexpect.spawn): def __init__(self, argv, input_data, *args, **kwargs): @@ -165,7 +137,6 @@ def launch_gsh(args, input_data=None): child = pexpect.spawn(args[0], args=args[1:], logfile=logfile) else: child = non_interactive_spawn(args, input_data, logfile=logfile) - traceback.print_stack(file=file('%s/%d' % (PID_DIR, child.pid), 'w')) return child if __name__ == '__main__': -- 2.11.4.GIT