Python-Überprüfung, ob ein fork () -Prozess abgeschlossen ist
Ich frage mich nur, ob mir jemand helfen könnte. Das Problem, das ich habe, ist, dass ich os.fork (), um einige Bits von Informationen zu erhalten und sie an eine Datei zu senden, aber zu überprüfen, ob der Gabelungsprozess nicht funktioniert.
import sys
import time
import os
import re
ADDRESS = argv[1]
sendBytes = argv[2]
proID2 = os.fork()
if proID2 == 0:
os.system('ping -c 20 ' + ADDRESS + ' > testStuff2.txt')
os._exit(0)
print proID2
finn = True
while finn == True:
time.sleep(1)
finn = os.path.exists("/proc/" + str(proID2))
print os.path.exists("/proc/" + str(proID2))
print 'eeup out of it ' + str(proID2)
Ich denke, dass os.path.exists () möglicherweise nicht das Richtige ist.
Vielen Dank.