[Gambas-user] Finding if app is launched from terminal or not

Bruce Steers 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
> or
> > 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
> need
> > 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.
>
> Best,
> Tobias
>
>
Fantastic , Thank you very muchly Tobias :)
Wishing well
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210629/b7feea17/attachment.htm>


More information about the User mailing list