I want to my app shows:
press any key to exit ...
And when I pressed any key, it exits.
How can I achieve this?
You can read a single key-press from a terminal in raw mode. Here is a package that should provide raw terminal mode to your program. Catch: it's Linux only.