I want to make a background process that displays a file
with an external viewer
. When the process is stopped, it should delete the file.
The following piece of code does what I want to do, but it is ugly and I guess there is a more idiomatic way.
It would be perfect, if it is even OS independent.
subprocess.Popen(viewer + ' ' + file + ' && rm ' + file, shell=True)