Skip to content

Kills python and all subprocesses, restarts with the same args, Windows only, works with pyinstaller

License

Notifications You must be signed in to change notification settings

hansalemaos/babyonemoretime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kills python + all subprocesses, restarts with the same args, Windows only, works with pyinstaller

pip install babyonemoretime

from babyonemoretime import restart_everything
from time import sleep
import subprocess
import sys

sleep(4)
if sys.argv[1] == "n":
    subprocess.Popen("notepad.exe")
else:
    subprocess.Popen("word.exe")

sleep(4)
restart_everything(pyfile=__file__, sysarv=sys.argv, restart=False)  # kills everything
restart_everything(pyfile=__file__, sysarv=sys.argv, restart=True) # kills everything and restarts




# python.exe resa.py n

About

Kills python and all subprocesses, restarts with the same args, Windows only, works with pyinstaller

Topics

Resources

License

Stars

Watchers

Forks

Languages