Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
子进程在python中完成执行时如何通知父进程_Python_Python 3.x_Subprocess - Fatal编程技术网

子进程在python中完成执行时如何通知父进程

子进程在python中完成执行时如何通知父进程,python,python-3.x,subprocess,Python,Python 3.x,Subprocess,对不起,我是python新手。我需要我的子进程通知调用他的父进程,但我无法为此阻止父进程 我有类似的东西,但这不是我需要的 def signal_handling(signum, frame): sub.kill() sys.exit() sub = subprocess.Popen(["python3.7", "test.py"]) signal.signal(signal.SIGINT, signal_handling) while True: sub.wait

对不起,我是python新手。我需要我的子进程通知调用他的父进程,但我无法为此阻止父进程

我有类似的东西,但这不是我需要的

def signal_handling(signum, frame):
    sub.kill()
    sys.exit()


sub = subprocess.Popen(["python3.7", "test.py"])

signal.signal(signal.SIGINT, signal_handling)
while True:
    sub.wait()

当其子进程退出时,父进程总是收到一个
SIGCHLD
。钩住它,你就不需要再陷害任何东西了。嗯,我明白了。我在这里做了测试,它成功了。非常感谢。当其子进程退出时,父进程总是收到一个
SIGCHLD
。钩住它,你就不需要再陷害任何东西了。嗯,我明白了。我在这里做了测试,它成功了。非常感谢你。