为什么这个python程序不终止?

2024-03-28 18:44:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我是Python和Fuse的新手。我在我的系统上运行着别人的保险丝代码。在

以下是启动程序的主要方法:

if __name__ == '__main__':
    os.system('clear')
    print "\n[*] Filesystem has been started.\n==============================================="
    main(sys.argv[1], sys.argv[2])

这叫这个

^{2}$

它(我现在知道)从Fuse调用init方法。。。What is happening when this code calls FUSE like this?

class FuseHandler(Operations):
    '''
    Class must implement reading a file, writing a file, and listing a directory.
    POSIX calls will be redirected as such.
    '''
    def __init__(self, root):
        self.root = realpath(root)      
        # Set up a working directory in case this is the first run
        self.printStatus()
        print '[-] End of Fuse init method: system initialized'

当我运行这个程序时,它一直运行到init方法的末尾,然后打印出来

"End of Fuse init method: system initialized."

但是光标会闪烁,就像Python期望输入一样。程序不会终止。它在干什么?在调用Fuse init之后,代码“go”在哪里?这是一个正在运行的保险丝控制台的样子吗?在

enter image description here


Tags: 方法代码self程序initismainsys
1条回答
网友
1楼 · 发布于 2024-03-28 18:44:19

通过FUSE(...)调用,您将控制权交给FusePy库,该库必须保持程序运行(下面可能有一个事件分派循环);否则,如果FusePy库立即终止,程序如何继续响应Fuse文件操作请求(其实现在handler类中)?在

相关问题 更多 >