create_subprocess_shell does not have the user parameter that asyncio has
還沒有人認領這個 Issue。
評估
研究方向
從 uvloop 的 create_subprocess_shell 實作開始,將其接受的引數與 Python asyncio subprocess 文件進行比較。在 uvloop 上重現所提供的範例,並確認 user 參數能夠被接受,且其行為與 asyncio 一致,不會引發 unexpected-keyword TypeError。
由索引模型根據 Issue 內容生成。
描述
- uvloop version: 0.20.0
- Python version: 3.12.3
- Platform: Ubuntu 24
- Can you reproduce the bug with
PYTHONASYNCIODEBUGin env?: yes - Does uvloop behave differently from vanilla asyncio? How?: yes
Below is a slightly modified minimal example from the stdlib, with the addition of the user parameter.
https://docs.python.org/3/library/asyncio-subprocess.html
It will work with asyncio, but the parameter is missing for uvloop in the corresponding method:
TypeError: __subprocess_run() got an unexpected keyword argument 'user'
import asyncio
import getpass
import uvloop
async def run(cmd, user: None | int | str = getpass.getuser()):
proc = await asyncio.create_subprocess_shell(
cmd,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
user=user,
)
stdout, stderr = await proc.communicate()
print(f"[{cmd!r} exited with {proc.returncode}]")
if stdout:
print(f"[stdout]\n{stdout.decode()}")
if stderr:
print(f"[stderr]\n{stderr.decode()}")
asyncio.run(run("ls /tmp")) # this works
uvloop.install()
asyncio.run(run("ls /tmp")) # this errors
Could this be fixed/enhanced? This is very useful for scenarios where both changing the user and environment variables are required, since doing "su" to another user does not transfer the environment variables, and it then needs to be handled in a rather tedious way.
Thank you!
- 主要語言
- Cython
- 星號
- 11.9k
- 分支
- 615
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
MagicStack/uvloop 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 68/100
MagicStack/uvloop#759 ·
-
難度 2/5 1-3 小時 新手友好度 68/100
MagicStack/uvloop#741 · 2 個 reaction ·
-
難度 2/5 1-3 小時 新手友好度 68/100
MagicStack/uvloop#702 · 8 則留言 · 9 個 reaction ·
-
難度 4/5 3-5 天 新手友好度 25/100
MagicStack/uvloop#766 ·
-
難度 4/5 3-5 天 新手友好度 52/100
MagicStack/uvloop#765 ·
查看 MagicStack/uvloop 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 75/100
mksglu/context-mode#1200 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
-
難度 2/5 1-3 小時 新手友好度 70/100
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr impact:auth-provider issue-rating: 🌊 off-meta tidepool P2
難度 1/5 1 小時以內 新手友好度 80/100
-
難度 2/5 1-3 小時 新手友好度 75/100