Skip to content

Improve run_process defaults if there's a shell#3273

Open
A5rocks wants to merge 5 commits intopython-trio:mainfrom
A5rocks:experiments/nicer-run_process-shell
Open

Improve run_process defaults if there's a shell#3273
A5rocks wants to merge 5 commits intopython-trio:mainfrom
A5rocks:experiments/nicer-run_process-shell

Conversation

@A5rocks
Copy link
Contributor

@A5rocks A5rocks commented May 25, 2025

Fixes #3237

If shell=True, then it's possible that things we spawn will themselves spawn things. This is a problem because we only kill the parent process and those don't automatically propagate signals. We can solve this by default by making sure shell processes get their own process group which we subsequently kill.

@codecov
Copy link

codecov bot commented May 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00000%. Comparing base (0124394) to head (190230d).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@               Coverage Diff               @@
##                 main        #3273   +/-   ##
===============================================
  Coverage   100.00000%   100.00000%           
===============================================
  Files             128          128           
  Lines           19414        19474   +60     
  Branches         1318         1326    +8     
===============================================
+ Hits            19414        19474   +60     
Files with missing lines Coverage Δ
src/trio/_subprocess.py 100.00000% <100.00000%> (ø)
src/trio/_tests/test_subprocess.py 100.00000% <100.00000%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@A5rocks A5rocks force-pushed the experiments/nicer-run_process-shell branch 3 times, most recently from 18e65e8 to 165b103 Compare May 27, 2025 04:29
- `shell=True` implies `process_group=0`
- make default `deliver_cancel` aware of process groups
- backport `process_group` to Pythons prior to 3.11
@A5rocks A5rocks force-pushed the experiments/nicer-run_process-shell branch from 165b103 to 60ecb14 Compare May 27, 2025 04:35
@A5rocks
Copy link
Contributor Author

A5rocks commented Feb 16, 2026

test_mock_clock_autojump failed on Windows 3.14 w/ free threading but I think that's a flake.

@J2085isa
Copy link

J2085isa commented Feb 16, 2026 via email

@J2085isa
Copy link

J2085isa commented Feb 16, 2026 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shell command does not terminate on cancel

3 participants