Mozilla-authored process handling
Project description
[mozprocess](https://github.com/mozautomation/mozmill/tree/master/mozprocess)
provides python process management via an operating system
and platform transparent interface to Mozilla platforms of interest.
Mozprocess aims to ensure the ability to robustly terminate a process
on Windows, OS X, and Linux. Mozprocess aims to provide the ability
to robustly terminate a process (by timeout or otherwise), along with
any child processes, on Windows, OS X, and Linux. Mozprocess utilizes
and extends `subprocess.Popen` to these ends.
# API
[mozprocess.processhandler:ProcessHandler](https://github.com/mozautomation/mozmill/blob/master/mozprocess/mozprocess/processhandler.py)
is the central exposed API for mozprocess. `ProcessHandler` utilizes
a contained subclass of [subprocess.Popen](http://docs.python.org/library/subprocess.html),
`Process`, which does the brunt of the process management.
Basic usage:
process = ProcessHandler(['command', '-line', 'arguments'],
cwd=None, # working directory for cmd; defaults to None
env={}, # environment to use for the process; defaults to os.environ
)
exit_code = process.waitForFinish(timeout=60) # seconds
See an example in https://github.com/mozautomation/mozmill/blob/master/mutt/mutt/tests/python/testprofilepath.py
`ProcessHandler` may be subclassed to handle process timeouts (by overriding
the `onTimeout()` method), process completion (by overriding
`onFinish()`), and to process the command output (by overriding
`processOutputLine()`).
# TODO
- Document improvements over `subprocess.Popen.kill`
provides python process management via an operating system
and platform transparent interface to Mozilla platforms of interest.
Mozprocess aims to ensure the ability to robustly terminate a process
on Windows, OS X, and Linux. Mozprocess aims to provide the ability
to robustly terminate a process (by timeout or otherwise), along with
any child processes, on Windows, OS X, and Linux. Mozprocess utilizes
and extends `subprocess.Popen` to these ends.
# API
[mozprocess.processhandler:ProcessHandler](https://github.com/mozautomation/mozmill/blob/master/mozprocess/mozprocess/processhandler.py)
is the central exposed API for mozprocess. `ProcessHandler` utilizes
a contained subclass of [subprocess.Popen](http://docs.python.org/library/subprocess.html),
`Process`, which does the brunt of the process management.
Basic usage:
process = ProcessHandler(['command', '-line', 'arguments'],
cwd=None, # working directory for cmd; defaults to None
env={}, # environment to use for the process; defaults to os.environ
)
exit_code = process.waitForFinish(timeout=60) # seconds
See an example in https://github.com/mozautomation/mozmill/blob/master/mutt/mutt/tests/python/testprofilepath.py
`ProcessHandler` may be subclassed to handle process timeouts (by overriding
the `onTimeout()` method), process completion (by overriding
`onFinish()`), and to process the command output (by overriding
`processOutputLine()`).
# TODO
- Document improvements over `subprocess.Popen.kill`
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mozprocess-0.1b1.tar.gz
(17.4 kB
view details)
File details
Details for the file mozprocess-0.1b1.tar.gz
.
File metadata
- Download URL: mozprocess-0.1b1.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ada5288fd324e9180c15bd9969182394200d92c23486a517fc4afc0eaab6e338 |
|
MD5 | a3a3904c4cba0ce2552ddee3d40b28ea |
|
BLAKE2b-256 | bd5377d19475a7eeb958c833ff98d6963224cb1a4fbd2962f7a17731479d412b |