即使指定了超时,subprocess.run 也不会超时

Mik*_*ike 6 python-3.x

我有以下 Python 代码:

strRunOutput = subprocess.run([strFastbootExecutable, "-s", dsn.upper(), "reboot"], timeout=5, stderr=subprocess.PIPE).stderr.decode('utf-8').upper()
Run Code Online (Sandbox Code Playgroud)

这基本上是这样做的:

fastboot -s G070GV1871970FCW reboot
Run Code Online (Sandbox Code Playgroud)

这是输出:

< waiting for G070GV1871970FCW >
Run Code Online (Sandbox Code Playgroud)

...这是挂。为什么 fastboot 命令挂起,我不知道,但更让我烦恼的是 subprocess.run 命令在我告诉它的 5 秒后没有超时,并导致我的程序挂起。任何想法发生了什么?

谢谢!