나는 실행중인 .jar 파일이 Popen
을 통해 있습니다. 이 서버는 시작하는 데 약 4 초가 걸리고 터미널에서 "Server Started"를 덤프 한 다음 사용자가 터미널을 종료 할 때까지 실행됩니다. 그러나 print
과 webbrowser.open
은 Popen
때문에 즉시 실행되며 call
을 사용하면 절대 실행되지 않습니다. wait
을 사용하지 않고 서버를 시작해야만 print
과 webbrowser
이 실행되지 않도록 할 수 있습니까? 서버에 대한 grep이 시작되었을 수 있습니까?Python에서 명령 순서 보장
from subprocess import Popen
import glob
import sys
import webbrowser
reasoner = glob.glob("reasoner*.jar")
reasoner = reasoner.pop()
port = str(input("Enter connection port: "))
space = ""
portArg = ("-p", port)
portArg = space.join(portArg)
print "Navigate to the Reasoner at http://locahost:" + port
reasoner_process = Popen(["java", "-jar", reasoner, "-i", "0.0.0.0", portArg, "--dbconnect", "jdbc:h2:tcp://localhost//tmp/UXDemo;user=sa;password=admin"])
# I want the following to execute after the .jar process above
print "Opening http://locahost:" + port + "..."
webbrowser.open("http://locahost:" + port)