I'm trying to run a C program from within a python code.
cmd = 'gnome-terminal --command=./myprog'
subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
The code executes and the terminal closes.
I want to keep the terminal open after the execution is completed without having to add any extra code in the C file e.g. prompt the user for some input.
Is there a workaround for this?
Best Answer
To keep the terminal opened until a key is pressed:
To keep the terminal opened until
exit
:Replace
ls
with the command you want to execute (your compiled executable file).Note
If
--
does not work, try the old (deprecated)-x
approach instead: