Core Library0.xAPI reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

MoreLess about this notice

function libtmux

redact_stdout

Mask environment variable values in show-environment stdout lines.

Source and package
Qualified name
libtmux._internal.log_context.redact_stdout
Module
libtmux._internal.log_context
Package
libtmux
Source
src/libtmux/_internal/log_context.py
redact_stdout ( argv: Sequence[str], lines: Sequence[str] ) → list[str]

Description

Leaves output from other commands unchanged. Unscoped show-environment output is validated against tmux's RB_TREE strcmp byte ordering so PEM headers, whitespace-bearing lines, and out-of-order continuations collapse to ***; pass -s or a single variable name when a multiline value could contain an =-bearing token that sorts lexicographically after the variable name with no later entries to bound it. When show-environment is chained with another command or run inside a command carrier, every stdout line is masked to ***.

Parameters

Examples

>>> redact_stdout(
... ["tmux", "show-environment"],
... ["-dash=secret", "EDITOR=vim", "-UNSET_VAR", "continuation"],
... )
['-dash=***', 'EDITOR=***', '-UNSET_VAR', '***']
>>> redact_stdout(
... ["tmux", "showenv", "-s"],
... ['API_TOKEN="hunter2"; export API_TOKEN;', "unset OLD_VAR;"],
... )
['API_TOKEN="***"; export API_TOKEN;', 'unset OLD_VAR;']
>>> redact_stdout(
... ["tmux", "show-environment", ";", "list-sessions"],
... ["API_TOKEN=hunter2", "work: 1 windows"],
... )
['***', '***']
>>> redact_stdout(["tmux", "list-sessions"], ["work: 1 windows"])
['work: 1 windows']

Recorded calls

source calls
No call edges in the Python model.

The Python reference records declarations, not calls, so this page shows no callers or callees. That is a limit of the extracted data, not a statement that nothing calls libtmux._internal.log_context.redact_stdout.

Esc
Search in

Type to search.

Reference previewOpen reference