how to close an application launched from os.system()?

Viewed 27

in my script, i call an app from os.system()

command = f"python -m snakeviz {filename}"
os.system(command)

the problem is that this application is freezing the console, therefore freezing my python plugin.

we cannot input anything, ("exit" command won't work) the only way to close the terminal is by running CTRL+C shortcut, and the terminal might be hidden..

this app has no reason to keep running it just open a webpage, how can I force quit the command, without losing the rest of my script?

1 Answers

Whatever i did, the command froze my python plugin

I needed to open another process with Open() and need shlex to encrypt the command line to whatever this subprocess module need

command = f"python -m snakeviz myfile.log"
subprocess.Popen(shlex.split(command))
Related