check_handler.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:obsoleted-vpduserv 作者: InfraSIM 项目源码 文件源码
def main ():
    signal.signal (signal.SIGCHLD, signal_handler)
    pid, fd = pty.fork()
    if pid == 0:
        os.write (sys.stdout.fileno(), 'This is a test.\nThis is a test.')
        time.sleep(10000)
    nonblock (fd)
    tty.setraw(fd) #STDIN_FILENO)
    print 'Sending SIGKILL to child pid:', pid
    time.sleep(2)
    os.kill (pid, signal.SIGKILL)

    print 'Entering to sleep...'
    try:
        time.sleep(2)
    except:
        print 'Sleep interrupted'
    try:
        os.kill(pid, 0)
        print '\tChild is alive. This is ambiguous because it may be a Zombie.'
    except OSError as e:
        print '\tChild appears to be dead.'
#       print str(e)
    print
    print 'Reading from master fd:', os.read (fd, 1000)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号