Skip to content

tox exec should pass stdin through #3841

@masklinn

Description

@masklinn

What's the problem this feature will solve?

I regularly use tox exec to run small scripts and utilities in the context of a project (usually the project's tooling). In one specific project I have a stats/analysis script which usually gets run with a file, but earlier I ran it with data passed through stdin, and it did not work. After fiddling with the script itself to try and fix it I realised tox exec does not pass stdin through, the command being run just gets an empty stdin:

echo "foo" | tox exec -- python -c 'import sys; print(sys.stdin.read())'

results in an empty line (well two) rather than the input being printed out.

Describe the solution you'd like

Just to have the command receiving the stdin data.

Alternative Solutions

uv run works, but tox exec can be more convenient if tox is being used for everything else anyway (especially if the tox envs already have the extras included whereas you have to pass them in explicitly to uv run if they're not just dev dependencies).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions