Shell
Introduction to the Shell Utilities
Cement includes a Shell Utility Module with helpers for common tasks related to executing commands, spawning subprocesses/threads, and other tasks.
API References:
Prompting User Input
Requesting input from the user is straight forward, however we've included the shell.Prompt
utility to expand beyond just a simple one-dimensional input response.
example.py
Executing Commands
Shell commands can be executed via the shell.cmd()
function in two ways; by capturing STDOUT/STDERR and exit code, or just the exit code and letting STDOUT/STDERR print to console normally.
Spawning Processes and Threads
Spawning processes and threads is easy via the shell.spawn()
helper.
See the multiprocessing and threading modules in the Python standard library for more information on working with processes and threads.
Last updated