Registry / testing / mozshellutil

mozshellutil

JSON →
library1.0.0pypypi✓ verified 83d ago

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 mozshellutil
INSTALL
IMPORT
SIG · MOZSHELLUTIL
M
mozshellutil
testingpythonv1.0.0
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

shellutil
from mozshellutil import shellutil
from mozshellutil import Shell
quote
from mozshellutil import quote
split
from mozshellutil import split

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.

from mozshellutil import Shell, Command shell = Shell() # Run a simple command result = shell.run(Command(['echo', 'hello'])) print(result.stdout) # b'hello\n' # With arguments and environment env = {'MY_VAR': 'value'} if os.environ.get('TEST') else {} result = shell.run(Command(['printenv', 'MY_VAR'], env=env)) print(result.returncode)
Debug
Known issues
breakingCommand line parsing is minimal. Shell.run does not expand environment variables in arguments by default; you must pass them explicitly in the env dict.
fix
Use shell-specific expansion (e.g., os.path.expandvars) before creating Command.
affects: all
gotchaShell.run returns a MozShellResult object, not subprocess.CompletedProcess. Its fields are stdout, stderr, returncode but as bytes. Decode manually if needed.
fix
Access result.stdout.decode('utf-8') for string output.
affects: all
gotchaDo not pass a list of strings as a single string to Command; it expects a sequence. Passing a string will treat each character as a separate argument.
fix
Always provide a list of strings, e.g., Command(['ls', '-la']).
affects: all
Upgrade
Version history
1.0.0latest on PyPI · released Jan 19, 2026
Audit
Dependencies
mozfileoptionalUsed for file manipulation and temp directories.
Agent activity
4 hits · last 30 days
node
4
Resources
mozshellutil — pip install mozshellutil · libregistry