[Gambas-user] Finding if app is launched from terminal or not
bsteers4 at gmail.com
Tue Jun 29 11:18:07 CEST 2021
On Tue, 29 Jun 2021 at 10:10, Tobias Boege via User <
user at lists.gambas-basic.org> wrote:
> On Tue, 29 Jun 2021, Bruce Steers wrote:
> > Hi all, I have an app that uses lame to make mp3s from wav files and lame
> > puts info out to stdout as it works.
> > It's primary use is going to be either drag-n-drop files onto a launcher
> > right clicking files and choosing open with app.
> > Both those cases will not have a terminal so the app opens up it's own
> > terminalview form and runs the command in it.
> > but the app could also be run from terminal in which case it would not
> > the terminalview and could just output to stdout.
> > But i do not know of a good way to detect if the app has been run from a
> > terminal or i need to open it's own one.
> File.In.IsTerm is true if and only if the standard input of your program
> is connected to a (pseudo) terminal. This will be the case when you launch
> the program in a terminal emulator. It will also be the case if you launch
> it in the IDE (because it is connected to the TerminalView in the IDE).
> It will be false if you launch it via double click from your desktop.
Fantastic , Thank you very muchly Tobias :)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the User