diff options
author | dcbw <dcbw> | 2006-01-24 16:07:11 +0000 |
---|---|---|
committer | dcbw <dcbw> | 2006-01-24 16:07:11 +0000 |
commit | e242c19abf8f91641b7bf6e01c90ad1eb0ccd58a (patch) | |
tree | 7925d4a89d830b7f584ce3fc200b0d6042df0ced | |
parent | a4fb36c73e885f1f66cbd36cf33a1f33988745bd (diff) | |
download | mock-e242c19abf8f91641b7bf6e01c90ad1eb0ccd58a.tar.gz mock-e242c19abf8f91641b7bf6e01c90ad1eb0ccd58a.tar.xz mock-e242c19abf8f91641b7bf6e01c90ad1eb0ccd58a.zip |
Add an option to create a new process group so that both mock and
all of its children can be easily killed with kill(-<mock pid>) without
killing mock's parent (ie, plague-builder).
-rw-r--r-- | mock.py | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -648,6 +648,8 @@ def command_parse(): help="Arbitrary, unique extension to append to buildroot directory name") parser.add_option("--quiet", action ="store_true", dest="quiet", default=False, help="quiet down output") + parser.add_option("--setpgrp", action ="store_true", dest="setpgrp", + default=False, help="starts a new process group for mock") return parser.parse_args() @@ -711,7 +713,12 @@ def main(): if len(args) < 1: error("No srpm or command specified - nothing to do") sys.exit(50) - + + # If requested, become a process group leader so that us and + # _all_ of our children can more easily be killed with kill(2) + if options.setpgrp: + os.setpgrp() + # read in the config file by chroot name if options.chroot.endswith('.cfg'): cfg = '%s/%s' % (config_path, options.chroot) |