Skip to main content

Simple but powerful signal handling to process OS signals in python

Project description

listen

Simple but powerful signal handling to process OS signals in python

##Example Usage:

import listen
import subprocess

Instanciate SignalHandler

sig_hand = listen.SignalHandler()

Start external process

external_process = subprocess.Popen(['sh', '-c', 'sleep 30'])

Register some signal handlers to kill external process on SIGINT (ctrl-c)

kill_event = sig_hand.reg_on_status(external_process.kill)

Wait for external process

external_process.wait()

Press ctrl-c to send SIGINT or alternatively use the following to unregister the event

sig_hand.del_status_event(kill_event)

For a more detailed example including interaction with bash please see the tests/example.py and tests/external_process.bash

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

listen-0.2.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

listen-0.2.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file listen-0.2.1.tar.gz.

File metadata

  • Download URL: listen-0.2.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

File hashes

Hashes for listen-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5d28703b342fb8847de64cac473abba91b17fc4430f1c976ba381bb9bedfe2ee
MD5 868cf183e953465ebb6166e72705f59a
BLAKE2b-256 3c5c1218bff42d76a8c7233f6282ff1e84282175a3adc0649aa504ee9a89b1ef

See more details on using hashes here.

File details

Details for the file listen-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: listen-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

File hashes

Hashes for listen-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 87eecc0aff33ff54d5542cd8972dbaf21baeb9c06d3ddbb2a2c7290c85e3e69e
MD5 b71874cbff093d03c887556c85021439
BLAKE2b-256 51f73dc4278887bc260ce17943a9cc0ffd2694d58f402c686baee40eac094f50

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page