Nickpick
Nickpick

Reputation: 6587

subprocess.call and ending current program

My main program checks if a new version of itself is available and if so it downloads the new installer file and runs it: subprocess.call(["installer.exe"], shell=True) But in order to overwrite the old files, it needs to exit itself after calling the subprocess. How can I achieve this?

Upvotes: 3

Views: 42

Answers (1)

Jean-François Fabre
Jean-François Fabre

Reputation: 140148

In Windows, just start your installer program instead of waiting for it.

import subprocess

subprocess.call(["start","installer.exe"],shell=True)
print("out")

Running this will print out immediately and returns to the console if this is the last statement (or call sys.exit())

Upvotes: 2

Related Questions