Linux - Open terminal for input/output

One typical way would be to distribute a program.sh along with your executable. If .sh extension is bound to opening a terminal in their window manager of choice, it would open automatically. If not - it is enough of a hint for running it from the shell.

Without this file you could:

  1. Detect if the program is already running inside a terminal can be done with isatty(). There's a crate for it.
  2. If not, spawn the terminal app process (see process::Command) and relaunch the program with it by passing its path to the terminal command line options. As @Caesar mentioned there's a bunch of popular terminals that you might want to check for presence on Linux. If nothing is found, xterm could sometimes be a fallback.