我只是想知道在C中是否可以窥视输入缓冲区或执行类似的技巧,以了解对fgets的调用是否会在稍后阻塞。Java允许通过调用BufferedReader.ready()来做类似的事情,这样我就可以实现类似如下的控制台输入:
while (on && in.ready()) {
line = in.readLine();
/* do something with line */
if (!in.ready())
Thread.sleep(100);
}
这允许外部线程通过将on设置为false来优雅地关闭输入循环;我想在C中执行类似的实现,而不是求助于不可移植的
我正在寻找Python代码,这将运行一些Linux代码的孩子的终端和退出后,父母终端-所有的孩子的终端将被关闭。
下面是一个小示例,它应该如何工作:
import os
HOW_MANY_CHILDS_TERMINAL = 5
for x in range(HOW_MANY_CHILDS_TERMINAL):
print("X opened.")
os.system("do some linux stuff")
问题是,这会覆盖我当前的终端窗口。
我需要在单独的窗口中打开每个Linux命令。
接收错误: Building wheel for twisted-iocpsupport (PEP 517): started
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /tmp/tmpv8s6qz76 build_wheel /tmp/tmp9l8hgcva
cwd: /tmp/pip-install-qsr4j4x_/twisted-iocpsupport
Complete output (13 lines):
running bdist_wheel