Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
  • 17 commits
  • 5 files changed
  • 0 commit comments
  • 2 contributors
View
15 .travis.yml
@@ -0,0 +1,15 @@
+language: python
+python:
+ - "2.6"
+ - "2.7"
+ - "3.2"
+
+install: pip install . --use-mirrors
+
+script:
+ - python -c "import sys; sys.exit(sys.version_info[0]<3)" && 2to3 -w tests
+ - python setup.py test
+
+notifications:
+ email:
+ - hongqn@douban.com
View
3  README.rst
@@ -23,5 +23,8 @@ grandchild process will continue to run. The child process keeps checking the
status of parent. If it found that the parent has died, it kills grandchild
process (and grand-grandchild processes if there are any) and suicides.
+.. image:: https://secure.travis-ci.org/douban/CaoE.png?branch=develop
+ :alt: Build Status
+ :target: http://travis-ci.org/douban/CaoE
.. vim:set filetype=rst:
View
10 caoe.py
@@ -20,7 +20,8 @@ def install():
signal(SIGQUIT, handler)
signal(SIGTERM, handler)
signal(SIGCHLD, make_child_die_signal_handler(gid))
- pause()
+ while True:
+ pause()
def make_quit_signal_handler(gid, sig=SIGTERM):
@@ -32,7 +33,12 @@ def handler(signum, frame):
def make_child_die_signal_handler(gid, sig=SIGTERM):
def handler(signum, frame):
- pid, status = os.wait()
+ try:
+ pid, status = os.wait()
+ except OSError:
+ # sometimes there is no child processes already
+ status = 0
+
try:
signal(SIGTERM, SIG_DFL)
os.killpg(gid, sig)
View
9 setup.py
@@ -1,9 +1,13 @@
import sys, os
from setuptools import setup
+kw = {}
+if sys.version_info >= (3,):
+ kw['use_2to3'] = True
+
install_requires = []
-if sys.platform.startswith('linux'):
- install_requires.append('prctl')
+if sys.platform.startswith('linux') and sys.version_info < (3,):
+ install_requires.append('prctl') # prctl is not compatible with py3k yet.
setup(
name = "CaoE",
@@ -26,4 +30,5 @@
url = "https://github.com/douban/caoe",
test_suite = 'nose.collector',
tests_require = ['nose'],
+ **kw
)
View
1  tests/test_caoe.py
@@ -65,6 +65,7 @@ def test_all_child_processes_should_be_killed_if_parent_is_killed():
p.join()
cpids = [int(x.split('-')[1]) for x in os.listdir(tmpdir) if x.startswith('child-')]
eq_(len(cpids), 3)
+ time.sleep(1) # wait for killing children
ok_(all(not is_process_alive(pid) for pid in cpids))

No commit comments for this range

Something went wrong with that request. Please try again.