Whenever a program finishes to run when executing it with geany, the terminal doesn't close. geany terminal waits for a keystroke to close. How do I change this behavior and make it close automatically when the program reaches it's end? Is there a script I can write?
This is not really an answer, but more like an alternative suggestion. In newer versions of Geany you can tell it to run programs in the Vitual Terminal Emulation, i.e. the terminal tab at the bottom (Settings -> Terminal -> Run Programs in VTE).
This way, the program starts more quickly (without first starting a terminal), you can still see the output generated by the program (exception stacktraces!), and the focus/cursor stays in the editor window, too.
I actually found a way of doing what you want to do in the terminal instead of using Geany's VTE. The perk of that is that you can run multiple scripts at the same time (or a single one multiple times), while the VTE only executes one script at the time (at least that's the case for me).
Just go to Build -> Set Build Commands. The last type of options says "Execute commands". The standard option is python "%f"
.
Just add && exit
so that it reads
python "%f" && exit
.
That way the terminal window will close instantly once it's finished if the programm doesn't give you an error code. If it does, the error message will be displayed and the window is kept open.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With