diff options
author | necoro <> | 2007-07-11 07:37:22 +0000 |
---|---|---|
committer | necoro <> | 2007-07-11 07:37:22 +0000 |
commit | b5e8e2eb2b8bc9936070028ecf91ff8d0b7c33ef (patch) | |
tree | 366a8a3656d01dc2e30f28943c898a2578211409 /portato/helper.py | |
parent | 3637bd7900f3b480b5935279c598c39bee70a03e (diff) | |
download | portato-b5e8e2eb2b8bc9936070028ecf91ff8d0b7c33ef.tar.gz portato-b5e8e2eb2b8bc9936070028ecf91ff8d0b7c33ef.tar.bz2 portato-b5e8e2eb2b8bc9936070028ecf91ff8d0b7c33ef.zip |
added SIGSTOP/SIGCONT support; SIGTERM now works ;)
Diffstat (limited to '')
-rw-r--r-- | portato/helper.py | 16 |
1 files changed, 16 insertions, 0 deletions
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""" |