# libtmux._internal.log_context.redact_stdout

- **Module:** libtmux._internal.log_context
- **Package:** libtmux
- **Language:** Python
- **Kind:** function
- **Source:** https://github.com/tmux-python/libtmux/blob/efdbb5637666b166358772ecc737b3807beab21e/src/libtmux/_internal/log_context.py#L984
- **Page:** https://libtmux.org/en/py/latest/reference/libtmux-_internal-log_context-redact_stdout/

```
libtmux._internal.log_context.redact_stdout(
    argv: Sequence[str], lines: Sequence[str]
) -> list[str]
```

Mask environment variable values in [`show-environment`](/en/tmux/latest/manual/show-environment/) stdout lines.

Leaves output from other commands unchanged. Unscoped [`show-environment`](/en/tmux/latest/manual/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`](/en/tmux/latest/manual/show-environment/) is chained with another command or run inside
a command carrier, every stdout line is masked to ``***``.

## Parameters

- `argv` (`Sequence[str]`)
- `lines` (`Sequence[str]`)

## Examples

```python
>>> redact_stdout(
...     ["tmux", "show-environment"],
...     ["-dash=secret", "EDITOR=vim", "-UNSET_VAR", "continuation"],
... )
['-dash=***', 'EDITOR=***', '-UNSET_VAR', '***']
```

```python
>>> redact_stdout(
...     ["tmux", "showenv", "-s"],
...     ['API_TOKEN="hunter2"; export API_TOKEN;', "unset OLD_VAR;"],
... )
['API_TOKEN="***"; export API_TOKEN;', 'unset OLD_VAR;']
```

```python
>>> redact_stdout(
...     ["tmux", "show-environment", ";", "list-sessions"],
...     ["API_TOKEN=hunter2", "work: 1 windows"],
... )
['***', '***']
```

```python
>>> redact_stdout(["tmux", "list-sessions"], ["work: 1 windows"])
['work: 1 windows']
```
