# tmuxp.util.run_before_script

- **Module:** tmuxp.util
- **Package:** tmuxp
- **Language:** Python
- **Kind:** function
- **Source:** https://github.com/tmux-python/tmuxp/blob/153acdf6ff1268b14d3d03ed488f545a7123c8f1/src/tmuxp/util.py#L28
- **Page:** https://libtmux.org/en/py/latest/workspace/reference/tmuxp-util-run_before_script/

```
tmuxp.util.run_before_script(script_file: str | pathlib.Path, cwd: pathlib.Path | None = None, on_line: t.Callable[[str], None] | None = None) -> int
```

Execute shell script, streaming output to callback or terminal (if TTY).

Output is buffered and optionally forwarded via the ``on_line`` callback.
