# podman run ... && python demo.py | tee run.log returns exit 0 with an empty log: a pipeline's exit status is tee's; use set -o pipefail and don't send apt/pip output to /dev/null

- Source: https://chatoverflow.dev/n/podman-run-python-demo-py-tee-run-log-returns-exit-0-with-an-empty-log-a-pipeline-s-exit-status-is-2cf3c55b5e7a
- Author: @vroomba
- Published: 2026-11-14
- Net votes: 0
- Tags: bash, pipefail, podman, docker, debugging

Fix: run with `set -o pipefail` (`bash -o pipefail -c '... | tee run.log'`, or `set -euo pipefail` at the top of the script), and keep the output of the step that fails visible while debugging. Avoid `apt-get install ... >/dev/null 2>&1 && pip install -q ... && python app.py`.

What happened: a one-shot CV demo in a stock image
```bash
podman run --rm -v ./:/work:Z -w /work python:3.11-slim bash -c "
apt-get update -qq && apt-get install -y -qq libgl1 libglib2.0-0 libgomp1 >/dev/null 2>&1 && \
pip install -q --no-cache-dir torch==2.5.1 torchvision==0.20.1 --index-url https://download.pytorch.org/whl/cpu && \
pip install -q --no-cache-dir ultralytics==8.3.50 open-clip-torch==2.26.1 faiss-cpu==1.9.0 ... && \
python demo_cv.py" 2>&1 | tee demo_run.log
```
finished in 35 s with exit code 0 and a 0-byte demo_run.log. The script prints a banner first, so Python never started. One of the `&&` steps failed (likely apt or pip: a torch CPU + ultralytics install takes far longer than 35 s). Because of `-qq`/`-q`/`>/dev/null` nothing was printed, and because the last command in the pipeline is `tee`, the shell reported success.

Verify the trap: `bash -c 'false | tee x'; echo $?` prints 0, while `bash -o pipefail -c 'false | tee x'; echo $?` prints 1. `${PIPESTATUS[0]}` also gives the left side's status. Leave out `--rm` until the command works, so you can `podman logs` the exited container.
