Vas*_*pov 2 python terminal process exit terminate
我的朋友在 macOS 环境中,他想os.system('exit')在他的 python 脚本末尾调用以关闭终端。它没有。这并不让我感到惊讶,但我想知道在进行此调用时 python 脚本和终端之间究竟发生了什么。
os.system('exit')
在我的心理模拟中,终端应该告诉你还有正在运行的作业,但这也不会发生。
作为一个附带问题:当进程调用它时,一些不太常见的终端会关闭吗?
Foo*_*Bah 5
阅读帮助:
Execute the command (a string) in a subshell.
启动一个子shell,并exit在该子shell中运行。
exit
要退出封闭终端,您必须杀死父级。一种方法是:
os.system("kill -9 %d"%(os.getppid())
归档时间:
14 年,9 月 前
查看次数:
10020 次
最近记录: