view tests/killdaemons.py @ 13550:1792b8a9422b stable

merge: back out single-parent fast-forward merge This backs out changeset: 13158:9e7e24052745 user: Mads Kiilerich <mads@kiilerich.com> date: Tue Dec 07 03:29:21 2010 +0100 summary: merge: fast-forward merge with descendant Before named branches, the invariants were: a) "merges" always have two parents b) p1 is not linearly related to p2 Adding named branches made (b) problematic, so the above patch was introduced, which fixed (b) but broke (a). After discussion, we decided that the invariants should be: a) "merges" always have two parents b) p1 is not linearly related to p2 OR p1 and p2 are on different branches
author Matt Mackall <mpm@selenic.com>
date Mon, 07 Mar 2011 15:03:10 -0600
parents 13a1b2fb7ef2
children eddfb9a550d0
line wrap: on
line source

#!/usr/bin/env python

import os, time, errno, signal

# Kill off any leftover daemon processes
try:
    fp = open(os.environ['DAEMON_PIDS'])
    for line in fp:
        try:
            pid = int(line)
        except ValueError:
            continue
        try:
            os.kill(pid, 0)
            os.kill(pid, signal.SIGTERM)
            for i in range(10):
                time.sleep(0.05)
                os.kill(pid, 0)
            os.kill(pid, signal.SIGKILL)
        except OSError, err:
            if err.errno != errno.ESRCH:
                raise
    fp.close()
except IOError:
    pass