Upload app.py
Browse files
app.py
CHANGED
|
@@ -10,12 +10,16 @@ try:
|
|
| 10 |
bufsize=1, universal_newlines=True)
|
| 11 |
while process.poll() is None:
|
| 12 |
# 使用 select 模块检查是否有可读数据
|
| 13 |
-
ready_reads, _, _ = select.select([process.stdout, process.stderr], [], []
|
|
|
|
|
|
|
| 14 |
for ready in ready_reads:
|
| 15 |
# 读取输出并打印
|
| 16 |
output = ready.readline()
|
| 17 |
if output:
|
| 18 |
print(output, end='')
|
|
|
|
|
|
|
| 19 |
|
| 20 |
# 读取剩余的输出
|
| 21 |
for output in process.stdout.readlines() + process.stderr.readlines():
|
|
|
|
| 10 |
bufsize=1, universal_newlines=True)
|
| 11 |
while process.poll() is None:
|
| 12 |
# 使用 select 模块检查是否有可读数据
|
| 13 |
+
ready_reads, _, _ = select.select([process.stdout, process.stderr], [], [])
|
| 14 |
+
if not ready_reads:
|
| 15 |
+
print('select.select timeout')
|
| 16 |
for ready in ready_reads:
|
| 17 |
# 读取输出并打印
|
| 18 |
output = ready.readline()
|
| 19 |
if output:
|
| 20 |
print(output, end='')
|
| 21 |
+
else:
|
| 22 |
+
print('select.select timeout')
|
| 23 |
|
| 24 |
# 读取剩余的输出
|
| 25 |
for output in process.stdout.readlines() + process.stderr.readlines():
|