I'm developing a system (college work) that consists of a website for the use of a particular board. The problem is that to run the code on the card, I need to execute a lot of commands.
Currently my code looks like this:
def run():
comando = "cd nke/NKE0.7e/Placa && make clean && make && sudo make ispu && cd .. && sudo ./terminal64"
print(comando)
# print(os.system(comando)
process = subprocess.Popen(comando, stdout=subprocess.PIPE)
out, err = process.communicate()
print(out)
The problem is that terminal64
never ends (this is not a bug), so I would need to set a time for it to run and kill it. After that (for example, 2 minutes), I searched and I understood this can be done using the subprocess
library, but I could not execute the same command that was running in os.system
in it.
Can anyone help me to implement this command in subprocess
or to set a timeout in terminal64
?