MozShellUtil is a Python library providing shell command line parsing utilities for Mozilla testing. It offers functionality to parse and execute shell commands in a cross-platform manner, handling quotes, variables, and subprocess launching. The current version is 1.0.0, with a requirement of Python >=3.8. The library is maintained by the Mozilla community and released as needed.
pip install mozshellutilVerified import paths — ran on the pinned version, not inferred.
Creates a Shell instance to run Command objects. Each Command specifies the executable and arguments, and optionally an environment. The run method returns a CompletedProcess-like object.
Use shell-specific expansion (e.g., os.path.expandvars) before creating Command.
Access result.stdout.decode('utf-8') for string output.Always provide a list of strings, e.g., Command(['ls', '-la']).