Skip to content

Commit c5c4b7c

Browse files
nightcitybladenightcitybladeA5rockspre-commit-ci[bot]
authored
fix: correct error message for stdout pipe check in run_process (#3416)
* fix: correct error message for stdout pipe check in run_process * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: nightcityblade <nightcityblade@gmail.com> Co-authored-by: A5rocks <git@helvetica.moe> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent f418f64 commit c5c4b7c

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

newsfragments/3409.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed incorrect error message in ``run_process``: the ``stdout`` pipe check now correctly says "stdout" instead of "stdin".

src/trio/_subprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ async def my_deliver_cancel(process):
675675
if task_status is trio.TASK_STATUS_IGNORED:
676676
if stdin is subprocess.PIPE:
677677
raise ValueError(
678-
"stdout=subprocess.PIPE is only valid with nursery.start, "
678+
"stdin=subprocess.PIPE is only valid with nursery.start, "
679679
"since that's the only way to access the pipe; use nursery.start "
680680
"or pass the data you want to write directly",
681681
)

src/trio/_tests/test_subprocess.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,10 @@ async def test_run() -> None:
367367
with pytest.raises(UnicodeError):
368368
await run_process(CAT, stdin="oh no, it's text")
369369

370-
pipe_stdout_error = r"^stdout=subprocess\.PIPE is only valid with nursery\.start, since that's the only way to access the pipe(; use nursery\.start or pass the data you want to write directly)*$"
371-
with pytest.raises(ValueError, match=pipe_stdout_error):
370+
pipe_stdin_error = r"^stdin=subprocess\.PIPE is only valid with nursery\.start, since that's the only way to access the pipe; use nursery\.start or pass the data you want to write directly$"
371+
with pytest.raises(ValueError, match=pipe_stdin_error):
372372
await run_process(CAT, stdin=subprocess.PIPE)
373+
pipe_stdout_error = r"^stdout=subprocess\.PIPE is only valid with nursery\.start, since that's the only way to access the pipe$"
373374
with pytest.raises(ValueError, match=pipe_stdout_error):
374375
await run_process(CAT, stdout=subprocess.PIPE)
375376
with pytest.raises(

0 commit comments

Comments
 (0)