From b5e8e2eb2b8bc9936070028ecf91ff8d0b7c33ef Mon Sep 17 00:00:00 2001 From: necoro <> Date: Wed, 11 Jul 2007 07:37:22 +0000 Subject: added SIGSTOP/SIGCONT support; SIGTERM now works ;) --- portato/helper.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'portato/helper.py') diff --git a/portato/helper.py b/portato/helper.py index 9328223..cc797b9 100644 --- a/portato/helper.py +++ b/portato/helper.py @@ -18,6 +18,7 @@ Some nice functions used in the program. """ import traceback, os.path, sys, types +import os, signal DEBUG = True @@ -80,6 +81,21 @@ def debug(*args, **kwargs): else: print >> outfile, text +def send_signal_to_group (sig): + """Sends a signal to all processes of our process group (w/o ourselves). + + @param sig: signal number to send + @type sig: int""" + + def handler (sig, stack): + """Ignores the signal exactly one time and then restores the default.""" + signal.signal(sig, signal.SIG_DFL) + + signal.signal(sig, handler) + + pgid = os.getpgrp() + os.killpg(pgid, sig) + def am_i_root (): """Returns True if the current user is root, False otherwise. @rtype: boolean""" -- cgit v1.2.3