Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 576
Nickpick Avatar asked Dec 06 '25 21:12

Nickpick


1 Answers

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())

like image 76
Jean-François Fabre Avatar answered Dec 08 '25 09:12

Jean-François Fabre



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!