8000 Improve `run_process` defaults if there's a shell by A5rocks · Pull Request #3273 · python-trio/trio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve run_process defaults if there's a shell #3273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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.

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 (3029119) to head (60ecb14).
Report is 3 commits behind head on main.

Additional details and impacted files
@@               Coverage Diff               @@
##                 main        #3273   +/-   ##
===============================================
  Coverage   100.00000%   100.00000%           
===============================================
  Files             127          127           
  Lines           19257        19315   +58     
  Branches         1301         1311   +10     
===============================================
+ Hits            19257        19315   +58     
Files with missing lines Coverage Δ
src/trio/_subprocess.py 100.00000% <100.00000%> (ø)
src/trio/_tests/test_subprocess.py 100.00000% <100.00000%> (ø)
🚀 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
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
1 participant
0