
私のプログラムは次のとおりです
import subprocess
subprocess.run(f"timeout -s 9 30 cat", shell=True)
しかし、ttyの入力には応答しません。
タイムアウトを削除するか、通常のttyシェルから完全なコマンドを実行すると、期待どおりに機能します。
Pythonがハングする原因は何ですか?
環境:
$ uname -rv
5.10.0-13-amd64 #1 SMP Debian 5.10.106-1 (2022-03-17)
$ python3 --version
Python 3.9.2
$ bash --version
GNU bash, version 5.1.4(1)-release (x86_64-pc-linux-gnu)
$ dpkg -l | grep dash
ii dash 0.5.11+git20200708+dd9ef66-5 amd64 POSIX-compliant shell