Skip to main content

Context manager for background command-line programs

Project description

https://travis-ci.org/marc-lopez/process-wrapper.svg?branch=v0.1.2 https://coveralls.io/repos/marc-lopez/process-wrapper/badge.svg?branch=master

Process Wrapper is a simple module that executes a command-line style program via a context manager. This is useful if you want your script to do something that relies on a background process.

This module is conceived because of a need to automate the setup and teardown of the Django server when running Robotframework tests. Sample usage would look like this:

#!/usr/bin/env python

import robot
from process_wrapper import run_process

with run_process('python manage.py runserver'):
    robot.run('blackbox_test.robot')

Right now, the process being run is forcefully terminated with a SIGKILL or equivalent signal on context exit. Caution is advised.

To install

Run in command line:

pip install process-wrapper

Dependencies

psutil

Tested Capabilities

  • Kills parent and child processes on exit

Thanks to

jung rhew for providing the basis of process teardown code that I used

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

process-wrapper-0.1.2.zip (8.1 kB view hashes)

Uploaded Source

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