I developed an console application, with the dotnet framework. I want the application to run when called in a terminal session and when executing the .exe file.
Now I got a problem with the design of my application. When launching the exe, I need to ask if the program should be terminated, so that the user can read the output of my application (otherwise the application and therefore the terminal would close before any human could read what hs been printed).
But exactly this process of asking before the application stops executing is annoying if the application has been launched from the terminal, let's say by running dotnet myapp.dll
.
This is because when launching a terminal session the terminal doesn't close after an application has terminated.
So my question is if there exists any advice/ best practice/ or if there is a way of detecting if the application has been launched via an exe file or in the terminal.
Thanks for your advice.