comp.lang.ada
 help / color / mirror / Atom feed
* How to run a GNAT program without starting a terminal session
@ 2018-07-17  1:20 Jerry
  2018-07-17  4:35 ` Jerry
                   ` (4 more replies)
  0 siblings, 5 replies; 39+ messages in thread
From: Jerry @ 2018-07-17  1:20 UTC (permalink / raw)


How can I get Ada (GNAT) to run a program that has no text I/O without launching a terminal session? Specifically, on macOS, I have the following program. When I double-click it, it runs but first it opens Terminal.app and starts a session. I played with calling it from Applescript but without success. Can I make a bash file that doesn't start a terminal session?


with Ada.Calendar; use Ada.Calendar;
with Common; -- Contains "Beep".

procedure Run is
begin
    Delay 4.0;
    Common.Beep(1);
end Run;


Jerry

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17  1:20 How to run a GNAT program without starting a terminal session Jerry
@ 2018-07-17  4:35 ` Jerry
  2018-07-17  9:55 ` AdaMagica
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 39+ messages in thread
From: Jerry @ 2018-07-17  4:35 UTC (permalink / raw)


Maybe I should mention that Beep(n) causes the computer to emit n short sounds.

Jerry


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17  1:20 How to run a GNAT program without starting a terminal session Jerry
  2018-07-17  4:35 ` Jerry
@ 2018-07-17  9:55 ` AdaMagica
  2018-07-17 10:08   ` Jerry
  2018-07-17 12:46 ` Björn Lundin
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 39+ messages in thread
From: AdaMagica @ 2018-07-17  9:55 UTC (permalink / raw)


If I remember correcly, there is the linker switch -mwindows suppressing the terminal.

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17  9:55 ` AdaMagica
@ 2018-07-17 10:08   ` Jerry
  2018-07-17 10:23     ` Jerry
  2018-07-17 13:13     ` Dennis Lee Bieber
  0 siblings, 2 replies; 39+ messages in thread
From: Jerry @ 2018-07-17 10:08 UTC (permalink / raw)


On Tuesday, July 17, 2018 at 2:55:16 AM UTC-7, AdaMagica wrote:
> If I remember correcly, there is the linker switch -mwindows suppressing the terminal.

ld: unknown option: -mwindows

Jerry

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17 10:08   ` Jerry
@ 2018-07-17 10:23     ` Jerry
  2018-07-17 13:13     ` Dennis Lee Bieber
  1 sibling, 0 replies; 39+ messages in thread
From: Jerry @ 2018-07-17 10:23 UTC (permalink / raw)


On Tuesday, July 17, 2018 at 3:09:00 AM UTC-7, Jerry wrote:
> On Tuesday, July 17, 2018 at 2:55:16 AM UTC-7, AdaMagica wrote:
> > If I remember correcly, there is the linker switch -mwindows suppressing the terminal.
> 
> ld: unknown option: -mwindows
> 
> Jerry

-mwindows might be MS Windows specific.

Jerry

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17  1:20 How to run a GNAT program without starting a terminal session Jerry
  2018-07-17  4:35 ` Jerry
  2018-07-17  9:55 ` AdaMagica
@ 2018-07-17 12:46 ` Björn Lundin
  2018-07-17 16:20   ` Jeffrey R. Carter
  2018-07-17 21:07   ` Jerry
  2018-07-17 18:21 ` Shark8
  2018-07-19  2:57 ` Jerry
  4 siblings, 2 replies; 39+ messages in thread
From: Björn Lundin @ 2018-07-17 12:46 UTC (permalink / raw)


On 2018-07-17 03:20, Jerry wrote:
> How can I get Ada (GNAT) to run a program that has no text I/O without launching a terminal session? Specifically, on macOS, I have the following program. When I double-click it, it runs but first it opens Terminal.app and starts a session. I played with calling it from Applescript but without success. Can I make a bash file that doesn't start a terminal session?
> 
> 
> with Ada.Calendar; use Ada.Calendar;
> with Common; -- Contains "Beep".
> 
> procedure Run is
> begin
>     Delay 4.0;
>     Common.Beep(1);
> end Run;
> 
> 
> Jerry
> 

is it supposted to be a daemon?
check launchctrl
<https://superuser.com/questions/930389/how-to-start-a-service-using-mac-osxs-launchctl>



-- 
--
Björn


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17 10:08   ` Jerry
  2018-07-17 10:23     ` Jerry
@ 2018-07-17 13:13     ` Dennis Lee Bieber
  1 sibling, 0 replies; 39+ messages in thread
From: Dennis Lee Bieber @ 2018-07-17 13:13 UTC (permalink / raw)


On Tue, 17 Jul 2018 03:08:59 -0700 (PDT), Jerry <list_email@icloud.com>
declaimed the following:

>On Tuesday, July 17, 2018 at 2:55:16 AM UTC-7, AdaMagica wrote:
>> If I remember correcly, there is the linker switch -mwindows suppressing the terminal.
>
>ld: unknown option: -mwindows
>
	Per
https://gcc.gnu.org/onlinedocs/gnat_ugn/Platform-Specific-Information.html#Platform-Specific-Information
that is M$ only.

	Silly thought -- but what happens if you (somehow) redirect
stdin/stdout/stderr to bit-buckets or other non-interactive sources? It
could be that the console is created when the run-time system
opens/connects to those I/O streams and if they are connected elsewhere
won't appear.



-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/ 


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17 12:46 ` Björn Lundin
@ 2018-07-17 16:20   ` Jeffrey R. Carter
  2018-07-17 21:10     ` Jerry
  2018-07-17 21:07   ` Jerry
  1 sibling, 1 reply; 39+ messages in thread
From: Jeffrey R. Carter @ 2018-07-17 16:20 UTC (permalink / raw)


On 2018-07-17 03:20, Jerry wrote:
> How can I get Ada (GNAT) to run a program that has no text I/O without launching a terminal session? Specifically, on macOS, I have the following program. When I double-click it, it runs but first it opens Terminal.app and starts a session. I played with calling it from Applescript but without success. Can I make a bash file that doesn't start a terminal session?

I don't know how much MacOS is like Linux, but with the latter, if I create a 
menu entry for my program, there's a check box "Run in terminal". If I leave 
that unchecked, I don't get a terminal window.

-- 
Jeff Carter
"You tiny-brained wipers of other people's bottoms!"
Monty Python & the Holy Grail
18


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17  1:20 How to run a GNAT program without starting a terminal session Jerry
                   ` (2 preceding siblings ...)
  2018-07-17 12:46 ` Björn Lundin
@ 2018-07-17 18:21 ` Shark8
  2018-07-17 20:53   ` Jerry
  2018-07-19  2:57 ` Jerry
  4 siblings, 1 reply; 39+ messages in thread
From: Shark8 @ 2018-07-17 18:21 UTC (permalink / raw)


On Monday, July 16, 2018 at 7:20:50 PM UTC-6, Jerry wrote:
> How can I get Ada (GNAT) to run a program that has no text I/O without launching a terminal session? Specifically, on macOS, I have the following program. When I double-click it, it runs but first it opens Terminal.app and starts a session. I played with calling it from Applescript but without success. Can I make a bash file that doesn't start a terminal session?
> 
> 
> with Ada.Calendar; use Ada.Calendar;
> with Common; -- Contains "Beep".
> 
> procedure Run is
> begin
>     Delay 4.0;
>     Common.Beep(1);
> end Run;
> 
> 
> Jerry

Since you're talking about GNAT in particular you can use GNAT's System.OS_Lib package as detailed in the last example here: https://rosettacode.org/wiki/Execute_a_system_command#Ada

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17 18:21 ` Shark8
@ 2018-07-17 20:53   ` Jerry
  2018-07-18 16:34     ` Shark8
  0 siblings, 1 reply; 39+ messages in thread
From: Jerry @ 2018-07-17 20:53 UTC (permalink / raw)


On Tuesday, July 17, 2018 at 11:21:40 AM UTC-7, Shark8 wrote:
> 
> Since you're talking about GNAT in particular you can use GNAT's System.OS_Lib package as detailed in the last example here: https://rosettacode.org/wiki/Execute_a_system_command#Ada

If I understand this example, the main program here, Execute_Synchronously, starts another process using the Spawn procedure, presumably without starting a separate session. I want the _main_ program to execute without starting a terminal session.

Jerry


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17 12:46 ` Björn Lundin
  2018-07-17 16:20   ` Jeffrey R. Carter
@ 2018-07-17 21:07   ` Jerry
  2018-07-17 21:12     ` Shark8
  1 sibling, 1 reply; 39+ messages in thread
From: Jerry @ 2018-07-17 21:07 UTC (permalink / raw)


On Tuesday, July 17, 2018 at 5:46:39 AM UTC-7, björn lundin wrote:
> On 2018-07-17 03:20, Jerry wrote:
> > How can I get Ada (GNAT) to run a program that has no text I/O without launching a terminal session? Specifically, on macOS, I have the following program. When I double-click it, it runs but first it opens Terminal.app and starts a session. I played with calling it from Applescript but without success. Can I make a bash file that doesn't start a terminal session?
> > 
> > 
> > with Ada.Calendar; use Ada.Calendar;
> > with Common; -- Contains "Beep".
> > 
> > procedure Run is
> > begin
> >     Delay 4.0;
> >     Common.Beep(1);
> > end Run;
> > 
> > 
> > Jerry
> > 
> 
> is it supposted to be a daemon?
> check launchctrl
> <https://superuser.com/questions/930389/how-to-start-a-service-using-mac-osxs-launchctl>
> 
> 
> 
> -- 
> --
> Björn

I'm not sure exactly what is meant by a daemon but I think it is a faceless program that runs in the background over an extended period of time. Mine might satisfy that definition--it is faceless and runs until all of the several "delay-beep" pairs are executed, then quits.

Apple's launchctrl might work but it looks very complicated to learn.

Jerry

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17 16:20   ` Jeffrey R. Carter
@ 2018-07-17 21:10     ` Jerry
  2018-07-18  6:27       ` Jeffrey R. Carter
  0 siblings, 1 reply; 39+ messages in thread
From: Jerry @ 2018-07-17 21:10 UTC (permalink / raw)


On Tuesday, July 17, 2018 at 9:20:58 AM UTC-7, Jeffrey R. Carter wrote:
> On 2018-07-17 03:20, Jerry wrote:
> > How can I get Ada (GNAT) to run a program that has no text I/O without launching a terminal session? Specifically, on macOS, I have the following program. When I double-click it, it runs but first it opens Terminal.app and starts a session. I played with calling it from Applescript but without success. Can I make a bash file that doesn't start a terminal session?
> 
> I don't know how much MacOS is like Linux, but with the latter, if I create a 
> menu entry for my program, there's a check box "Run in terminal". If I leave 
> that unchecked, I don't get a terminal window.
> 
> -- 
> Jeff Carter
> "You tiny-brained wipers of other people's bottoms!"
> Monty Python & the Holy Grail
> 18

This sounds interesting but I think I'm missing some context. What do you mean by "create a menu entry for my program" and where is the mentioned check box? Are you referring to GPS? If so, what switch does GPS change to make this happen?

Jerry


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17 21:07   ` Jerry
@ 2018-07-17 21:12     ` Shark8
  2018-07-17 21:56       ` Jerry
  2018-07-18  7:37       ` Björn Lundin
  0 siblings, 2 replies; 39+ messages in thread
From: Shark8 @ 2018-07-17 21:12 UTC (permalink / raw)


On Tuesday, July 17, 2018 at 3:07:30 PM UTC-6, Jerry wrote:
> 
> I'm not sure exactly what is meant by a daemon but I think it is a faceless program that runs in the background over an extended period of time. Mine might satisfy that definition--it is faceless and runs until all of the several "delay-beep" pairs are executed, then quits.

My recommendation: use Ada's timing and tasking features.
A lot of the cases I've seen where daemons are used/needed are because the language [PHP in this case] didn't have any notion of TASKs and DELAYs -- rather frustrating to come across when it's so trivially easy in Ada.


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17 21:12     ` Shark8
@ 2018-07-17 21:56       ` Jerry
  2018-07-18  1:33         ` Shark8
  2018-07-18  7:37       ` Björn Lundin
  1 sibling, 1 reply; 39+ messages in thread
From: Jerry @ 2018-07-17 21:56 UTC (permalink / raw)


On Tuesday, July 17, 2018 at 2:12:54 PM UTC-7, Shark8 wrote:
> On Tuesday, July 17, 2018 at 3:07:30 PM UTC-6, Jerry wrote:
> > 
> > I'm not sure exactly what is meant by a daemon but I think it is a faceless program that runs in the background over an extended period of time. Mine might satisfy that definition--it is faceless and runs until all of the several "delay-beep" pairs are executed, then quits.
> 
> My recommendation: use Ada's timing and tasking features.
> A lot of the cases I've seen where daemons are used/needed are because the language [PHP in this case] didn't have any notion of TASKs and DELAYs -- rather frustrating to come across when it's so trivially easy in Ada.

Thanks for that idea. I've never used a task before but I modified a little program from the new book, Introduction to Ada Programming, 2nd ed., as follows:


procedure Hello_World_Task is
    task type Hello_Task;
    
    task body Hello_Task is
    begin
            delay 4.0;
    end Hello_Task;
        
    Task_1 : Hello_Task;
begin
    null;
end Hello_World_Task;


It still runs in the terminal.

Jerry

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17 21:56       ` Jerry
@ 2018-07-18  1:33         ` Shark8
  0 siblings, 0 replies; 39+ messages in thread
From: Shark8 @ 2018-07-18  1:33 UTC (permalink / raw)


On Tuesday, July 17, 2018 at 3:56:24 PM UTC-6, Jerry wrote:
With
Ada.Calendar.Formatting,
Ada.Text_IO;

Use
Ada.Text_IO;

Procedure Test is
    Task Type Hello( Cycle_Timing : not null access Duration ) is
	Entry Stop;
    end Hello;
    
    Task Body Hello is
	Finished : Boolean := False;
    Begin
	Ada.Text_IO.Put_Line( "Starting Task Hello." );
	loop
	    select
		accept Stop  do
		    null;
		end Stop;
		Finished:= True;
	    OR
		delay Cycle_Timing.all;
	    end select;
	    Exit when Finished;
	    -- TIMED PORTION.
	    Ada.Text_IO.Put_Line( "The time is now: " &
		Ada.Calendar.Formatting.Image(
			Ada.Calendar.Clock
			    )
			  & '.' );
	end loop;
	Ada.Text_IO.Put_Line( "Finishing Task Hello." );
    End Hello;
    

    
    Greeter : Hello( new Duration'(3.0) ); -- 3 second cycle.
Begin
    --Runner;
    
    declare
        -- Wait until the user hits enter...
	Tmp : String renames Get_Line;
    Begin
        -- then stop the Greeter task.
	Greeter.Stop;
    End;
End Test;

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17 21:10     ` Jerry
@ 2018-07-18  6:27       ` Jeffrey R. Carter
  2018-07-19  1:41         ` Jerry
  0 siblings, 1 reply; 39+ messages in thread
From: Jeffrey R. Carter @ 2018-07-18  6:27 UTC (permalink / raw)


On 07/17/2018 11:10 PM, Jerry wrote:
> On Tuesday, July 17, 2018 at 9:20:58 AM UTC-7, Jeffrey R. Carter wrote:
>>
>> I don't know how much MacOS is like Linux, but with the latter, if I create a
>> menu entry for my program, there's a check box "Run in terminal". If I leave
>> that unchecked, I don't get a terminal window.
> 
> This sounds interesting but I think I'm missing some context. What do you mean by "create a menu entry for my program" and where is the mentioned check box? Are you referring to GPS? If so, what switch does GPS change to make this happen?

No, this is part of the Linux desktop. In my case, I'm running Xubuntu. The task 
bar (by default at the top of the screen) has a menu button that opens a menu 
that lets you run programs. You can edit the menu, adding and removing menu 
items. Existing menu items may be modified. The "Run in terminal" check box is 
available when adding and editing menu items.

The menu items are technically "Launchers", things that launch programs. I think 
you can also have launchers not in the menu, such as on the desktop, but I've 
never used that.

Xubuntu uses the XFCE desktop; other flavors of Linux use other desktops, but 
most have something similar. Since MacOS, like Linux, is Yet Another Version of 
Unix (YAVU) with a graphical desktop, it probably has something similar.

-- 
Jeff Carter
"When Bell Labs were invited to evaluate C against the DoD requirements
[for Ada], they said that there was no chance of C meeting the
requirements of readability, safety, etc. for which we were striving,
and that it should not even be on the list of evaluated languages."
William Whitaker
116

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17 21:12     ` Shark8
  2018-07-17 21:56       ` Jerry
@ 2018-07-18  7:37       ` Björn Lundin
  2018-07-18 16:41         ` Shark8
                           ` (2 more replies)
  1 sibling, 3 replies; 39+ messages in thread
From: Björn Lundin @ 2018-07-18  7:37 UTC (permalink / raw)


On 2018-07-17 23:12, Shark8 wrote:
> A lot of the cases I've seen where daemons are used/needed are because the language [PHP in this case] didn't have any notion of TASKs and DELAYs -- rather frustrating to come across when it's so trivially easy in Ada.

No, that is not it at all.
A daemon is a detached background process, like services are on windows.
They have no user interface and are supposed to run a long time.
webservers, mailservers etc are typically daemons.
Has absolutely nothing to do whit language/tasks/delays at all

<https://en.wikipedia.org/wiki/Daemon_%28computing%29>

However this is what I thought you wanted, a process in the background.
But I realize it is not.

I have not seen the option that Jeff talks about in MacOsx, junst in
windows and in Linux desktops.
Perhaps you can use
<http://sveinbjorn.org/platypus>

Write a one-liner bash that starts you program, and point platypus to that.

(No I have not tried it myself)

-- 
--
Björn


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17 20:53   ` Jerry
@ 2018-07-18 16:34     ` Shark8
  2018-07-18 20:30       ` Björn Lundin
  0 siblings, 1 reply; 39+ messages in thread
From: Shark8 @ 2018-07-18 16:34 UTC (permalink / raw)


On Tuesday, July 17, 2018 at 2:53:57 PM UTC-6, Jerry wrote:
>  I want the _main_ program to execute without starting a terminal session.

What do you have that's causing a terminal to spawn?
Is it your launcher, with a "run in terminal" option set?
Is it the inclusion of terminal-/text-based IO, (eg) Ada.Text_IO?


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-18  7:37       ` Björn Lundin
@ 2018-07-18 16:41         ` Shark8
  2018-07-18 21:18         ` Jeffrey R. Carter
  2018-07-19  1:47         ` Jerry
  2 siblings, 0 replies; 39+ messages in thread
From: Shark8 @ 2018-07-18 16:41 UTC (permalink / raw)


On Wednesday, July 18, 2018 at 1:37:10 AM UTC-6, björn lundin wrote:
> On 2018-07-17 23:12, Shark8 wrote:
> > A lot of the cases I've seen where daemons are used/needed are because the language [PHP in this case] didn't have any notion of TASKs and DELAYs -- rather frustrating to come across when it's so trivially easy in Ada.
> 
> No, that is not it at all.
> A daemon is a detached background process, like services are on windows.

I never said it wasn't.
What I said was that the lack of TASK and DELAY necessitated the use of daemons in several PHP-based systems I've worked on.

> They have no user interface and are supposed to run a long time.
> webservers, mailservers etc are typically daemons.
So are things that (eg) clean the cache, ensure that some particular process is still active, and/or start some processing at timed intervals; I've seen each of these as a daemon, often as part of a larger system where a TASK and/or TASK/DELAY combo would be appropriate.

> Has absolutely nothing to do whit language/tasks/delays at all
> 
> <https://en.wikipedia.org/wiki/Daemon_%28computing%29>
Again, look at the above, think in terms of whole system; even if the 'system' includes manual administration. You're reading what I said backwards: it's not that Daemons are about TASK, it's that daemons are needed because the particular systems I was involved in had no notion of multi-threading and instead stitched together a system emulating it [as some level] via daemons.

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-18 16:34     ` Shark8
@ 2018-07-18 20:30       ` Björn Lundin
  2018-07-18 21:09         ` Dan'l Miller
  0 siblings, 1 reply; 39+ messages in thread
From: Björn Lundin @ 2018-07-18 20:30 UTC (permalink / raw)


On 2018-07-18 18:34, Shark8 wrote:
> On Tuesday, July 17, 2018 at 2:53:57 PM UTC-6, Jerry wrote:
>>  I want the _main_ program to execute without starting a terminal session.
> 
> What do you have that's causing a terminal to spawn?
> Is it your launcher, with a "run in terminal" option set?
> Is it the inclusion of terminal-/text-based IO, (eg) Ada.Text_IO?
> 

He's double-clicking the exe in finder (macosx)
Finder deems the program as a unix-executable (not a gui app with a
special directory structure on osx)
Finder says - unix - let's run it via terminal.

I really see no way out here - execpt the ones i suggested in another reply

-- 
--
Björn


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-18 20:30       ` Björn Lundin
@ 2018-07-18 21:09         ` Dan'l Miller
  2018-07-18 21:41           ` Bill Findlay
  2018-07-19  2:40           ` Jerry
  0 siblings, 2 replies; 39+ messages in thread
From: Dan'l Miller @ 2018-07-18 21:09 UTC (permalink / raw)


On Wednesday, July 18, 2018 at 3:30:22 PM UTC-5, björn lundin wrote:
> On 2018-07-18 18:34, Shark8 wrote:
> > On Tuesday, July 17, 2018 at 2:53:57 PM UTC-6, Jerry wrote:
> >>  I want the _main_ program to execute without starting a terminal session.
> > 
> > What do you have that's causing a terminal to spawn?
> > Is it your launcher, with a "run in terminal" option set?
> > Is it the inclusion of terminal-/text-based IO, (eg) Ada.Text_IO?
> > 
> 
> He's double-clicking the exe in finder (macosx)
> Finder deems the program as a unix-executable (not a gui app with a
> special directory structure on osx)
> Finder says - unix - let's run it via terminal.
> 
> I really see no way out here - execpt the ones i suggested in another reply
> 
> -- 
> --
> Björn

•Double-clicking• on an •icon/file-in-Finder• is a •user-interface• action which will beget a •user-interface• for that executable in MacOS.  Generally, once a UI thingy always begetting a UI thingy in MacOS.  There are 2 broad categories of user-interfaces:
1) GUI (pronounced gooey) a.k.a. Cocoa (or in an older now-defunct era Carbon)
and
2) ChUI (pronounced chewy) a.k.a. console app at the terminal.  The ChUI is via the terminal.

If not GUI via Cocoa (or in antiquity: Carbon), then it is mandatory for the UI to be ChUI/console-app via a terminal.  Please see the official Apple developer documentation linked below for various categories of executables that are neither GUI nor ChUI.

The prior replies have repeatedly correctly stated, this Ada executable must conform to the rules for daemons (or detached services).  In 1970s/1980s Unix-speak, dæmons are not-evil demons, without body/UI, merely pure spirit, i.e., detached from any /dev/tty device-special file, usually with their parent UID set to 1 instead of the parent process.  Or in fewer words, daemon is an executable that lacks a UI, typically running practically forever* in the background.  As currently formulated, this toy Ada program ••does not obey all the usual/customary rules for any of the 4 categories•• of daemon or detached service running practically forever in the background; see Apple developer information linked below.

* e.g., until next reboot, until overt manual shutdown, until stated mission is naturally complete hours or days or months from now; and so forth

https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/DesigningDaemons.html#//apple_ref/doc/uid/10000172i-SW4-BBCBHBFB

Btw, MacOS happens to have a (historically) BSD kernel (that is now somewhat heavily modified), but MacOS, especially as the personality presented in userspace, is truly a rather divergent not-terribly-Unix OS called Dylan.  Anyone who thinks that Dylan must conform to traditions of BSD Unix needs to remember that BSD Unix itself is a rather divergent OS diverging away from 1970s System III AT&T Unix, and that BSD Unix doesn't conform to all the conventions of System III AT&T Unix either.


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-18  7:37       ` Björn Lundin
  2018-07-18 16:41         ` Shark8
@ 2018-07-18 21:18         ` Jeffrey R. Carter
  2018-07-19  6:59           ` Jerry
  2018-07-19  1:47         ` Jerry
  2 siblings, 1 reply; 39+ messages in thread
From: Jeffrey R. Carter @ 2018-07-18 21:18 UTC (permalink / raw)


On 07/18/2018 09:37 AM, Björn Lundin wrote:
> 
> I have not seen the option that Jeff talks about in MacOsx, junst in
> windows and in Linux desktops.
> Perhaps you can use
> <http://sveinbjorn.org/platypus>

Several techniques are discussed here:

https://superuser.com/questions/360247/run-a-shell-script-on-os-x-without-having-a-terminal-window-appear#612072

Platypus is one of them.

-- 
Jeff Carter
"I'll get broads up here like you wouldn't believe.
Swingers. Freaks. Nymphomaniacs. Dental hygienists."
Play It Again, Sam
125

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-18 21:09         ` Dan'l Miller
@ 2018-07-18 21:41           ` Bill Findlay
  2018-07-19  2:13             ` Dan'l Miller
  2018-07-19  2:40           ` Jerry
  1 sibling, 1 reply; 39+ messages in thread
From: Bill Findlay @ 2018-07-18 21:41 UTC (permalink / raw)


On 18 Jul 2018, Dan'l Miller wrote
(in article<7500349d-e358-4c10-b4ec-6e95d44221af@googlegroups.com>):
>
> ... Or in fewer words, ...
>
> Btw, MacOS happens to have a (historically) BSD kernel (that is now somewhat
> heavily modified), but MacOS, especially as the personality presented in
> userspace, is truly a rather divergent not-terribly-Unix OS called Dylan.
> Anyone who thinks that Dylan must conform to traditions of BSD Unix needs to
> remember that BSD Unix itself is a rather divergent OS diverging away from
> 1970s System III AT&T Unix, and that BSD Unix doesn't conform to all the
> conventions of System III AT&T Unix either.

https://unix.stackexchange.com/questions/1489/is-mac-os-x-unix#1490

-- 
Bill Findlay


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-18  6:27       ` Jeffrey R. Carter
@ 2018-07-19  1:41         ` Jerry
  2018-07-19  2:31           ` Dennis Lee Bieber
  0 siblings, 1 reply; 39+ messages in thread
From: Jerry @ 2018-07-19  1:41 UTC (permalink / raw)


On Tuesday, July 17, 2018 at 11:27:14 PM UTC-7, Jeffrey R. Carter wrote:
> On 07/17/2018 11:10 PM, Jerry wrote:
> > On Tuesday, July 17, 2018 at 9:20:58 AM UTC-7, Jeffrey R. Carter wrote:
> >>
> >> I don't know how much MacOS is like Linux, but with the latter, if I create a
> >> menu entry for my program, there's a check box "Run in terminal". If I leave
> >> that unchecked, I don't get a terminal window.
> > 
> > This sounds interesting but I think I'm missing some context. What do you mean by "create a menu entry for my program" and where is the mentioned check box? Are you referring to GPS? If so, what switch does GPS change to make this happen?
> 
> No, this is part of the Linux desktop. In my case, I'm running Xubuntu. The task 
> bar (by default at the top of the screen) has a menu button that opens a menu 
> that lets you run programs. You can edit the menu, adding and removing menu 
> items. Existing menu items may be modified. The "Run in terminal" check box is 
> available when adding and editing menu items.
> 
> The menu items are technically "Launchers", things that launch programs. I think 
> you can also have launchers not in the menu, such as on the desktop, but I've 
> never used that.
> 
> Xubuntu uses the XFCE desktop; other flavors of Linux use other desktops, but 
> most have something similar. Since MacOS, like Linux, is Yet Another Version of 
> Unix (YAVU) with a graphical desktop, it probably has something similar.
> 
> -- 
> Jeff Carter
> "When Bell Labs were invited to evaluate C against the DoD requirements
> [for Ada], they said that there was no chance of C meeting the
> requirements of readability, safety, etc. for which we were striving,
> and that it should not even be on the list of evaluated languages."
> William Whitaker
> 116

Thank you for that explanation. macOS has a dock to which you can drag application files or document files or whatever, which sounds like a similar feature. However there is no option to tell an Ada executable to not use the terminal. The macOS file manager, called "Finder," identifies the executable as  "Unix executable" and defaults the parent application as Terminal.app, the macOS terminal program. That parent can be changed but the weird thing is the OS treats it as a file to be opened by another program. I can't see how to get around this. So whether I double-click the icon or launch it from the dock (the same thing, really), it opens the terminal. Also, when I tried to embed the Ada executable in an Applescript, it appeared to run (waiting the noted length of time specified by the Beep() commands) but nothing actually happened--no beeps to be heard.

Jerry

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-18  7:37       ` Björn Lundin
  2018-07-18 16:41         ` Shark8
  2018-07-18 21:18         ` Jeffrey R. Carter
@ 2018-07-19  1:47         ` Jerry
  2 siblings, 0 replies; 39+ messages in thread
From: Jerry @ 2018-07-19  1:47 UTC (permalink / raw)


On Wednesday, July 18, 2018 at 12:37:10 AM UTC-7, björn lundin wrote:
> On 2018-07-17 23:12, Shark8 wrote:
> > A lot of the cases I've seen where daemons are used/needed are because the language [PHP in this case] didn't have any notion of TASKs and DELAYs -- rather frustrating to come across when it's so trivially easy in Ada.
> 
> No, that is not it at all.
> A daemon is a detached background process, like services are on windows.
> They have no user interface and are supposed to run a long time.
> webservers, mailservers etc are typically daemons.
> Has absolutely nothing to do whit language/tasks/delays at all
> 
> <https://en.wikipedia.org/wiki/Daemon_%28computing%29>
> 
> However this is what I thought you wanted, a process in the background.
> But I realize it is not.
> 
> I have not seen the option that Jeff talks about in MacOsx, junst in
> windows and in Linux desktops.
> Perhaps you can use
> <http://sveinbjorn.org/platypus>
> 
> Write a one-liner bash that starts you program, and point platypus to that.
> 
> (No I have not tried it myself)
> 
> -- 
> --
> Björn

Thanks. That might actually work but I'm not sure--it seems that GNAT is determined to either open a terminal when an Ada program runs or do nothing at all, as indicated in my reply to Jeffrey about embedding it in an Applescript.

Platypus does create a proper application package so it is double-clickable. Could work.

This reminds me that  few years ago I wrote an extensive Ada wrapper around a similar project called Pashua https://www.bluem.net/en/projects/pashua/. With Pashua and my Ada work, you can run a significant subset of Mac GUI things easily written in Ada--it's just not a proper application bundle however, so it does not solve my immediate need.

I don't think the Pashua author includes my work with his distribution so if this interests anyone, let me know.

Jerry


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-18 21:41           ` Bill Findlay
@ 2018-07-19  2:13             ` Dan'l Miller
  0 siblings, 0 replies; 39+ messages in thread
From: Dan'l Miller @ 2018-07-19  2:13 UTC (permalink / raw)


On Wednesday, July 18, 2018 at 4:41:41 PM UTC-5, Bill Findlay wrote:
> On 18 Jul 2018, Dan'l Miller wrote
> (in article<7500349d-e358-4c10-b4ec-6e95d44221af@googlegroups.com>):
> >
> > ... Or in fewer words, ...
> >
> > Btw, MacOS happens to have a (historically) BSD kernel (that is now somewhat
> > heavily modified), but MacOS, especially as the personality presented in
> > userspace, is truly a rather divergent not-terribly-Unix OS called Dylan.
> > Anyone who thinks that Dylan must conform to traditions of BSD Unix needs to
> > remember that BSD Unix itself is a rather divergent OS diverging away from
> > 1970s System III AT&T Unix, and that BSD Unix doesn't conform to all the
> > conventions of System III AT&T Unix either.
> 
> https://unix.stackexchange.com/questions/1489/is-mac-os-x-unix#1490
> 
> -- 
> Bill Findlay

Yeah, and MacOS has XQuartz for legacy compatibility with XWindow11-era antiquity.  MacOS didn't go so far as •removing• their legacy backwards compatibility with legacy Unix antiquity.  But so much of MacOS is Unix-esque reinterpretation.  MacOS still has the ghost of Unix-past antiquity, but not of the ghost of Unix/Linux present, and likely not the ghost of Linux future (because even Linux is charting an overtly divergent course from Unix (e.g., systemd)).

Take for example launchd in https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/DesigningDaemons.html#//apple_ref/doc/uid/10000172i-SW4-BBCBHBFB 

launchd daemon is unique to MacOS:
https://en.wikipedia.org/wiki/Launchd

Note that launchd is Unix-esque in its general look & feel, but launchd is not any of {systemd, cron, init scripts} that are accepted in Unix/Linux cannon.

Another 1 of the 4 categories is XPC.  XPC again is very Unix-esque but has no direct equivalent in any other flavor of Unix or Linux, because XPC is bolted deeply onto Grand Central Dispatch (which again is vaguely Unixy* but unique to MacOS and iOS).

* Had Grand Central Dispatch appeared in BSD-world or SystemV-world during the 1980s or early 1990s, it would be part of the Unix-world cannon, but it didn't so it isn't.

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-19  1:41         ` Jerry
@ 2018-07-19  2:31           ` Dennis Lee Bieber
  0 siblings, 0 replies; 39+ messages in thread
From: Dennis Lee Bieber @ 2018-07-19  2:31 UTC (permalink / raw)


On Wed, 18 Jul 2018 18:41:10 -0700 (PDT), Jerry <list_email@icloud.com>
declaimed the following:


>Thank you for that explanation. macOS has a dock to which you can drag application files or document files or whatever, which sounds like a similar feature. However there is no option to tell an Ada executable to not use the terminal. The macOS file manager, called "Finder," identifies the executable as  "Unix executable" and defaults the parent application as Terminal.app, the macOS terminal program. That parent can be changed but the weird thing is the OS treats it as a file to be opened by another program. I can't see how to get around this. So whether I double-click the icon or launch it from the dock (the same thing, really), it opens the terminal. Also, when I tried to embed the Ada executable in an Applescript, it appeared to run (waiting the noted length of time specified by the Beep() commands) but nothing actually happened--no beeps to be heard.

	Behavior that would make me suspect that Beep() operation is what
requires a terminal/console (though console \a typically doesn't offer
duration or pitch options).

	What behavior do you get if you use a program that only opens a disk
file, writes something to it, and closes it? No esoteric Beep() or anything
else that might be construed to be a /user interface/.

	Where did the package Common come from? I'm not finding it in Google
when searching.


-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/ 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-18 21:09         ` Dan'l Miller
  2018-07-18 21:41           ` Bill Findlay
@ 2018-07-19  2:40           ` Jerry
  2018-07-19  3:19             ` Dan'l Miller
  1 sibling, 1 reply; 39+ messages in thread
From: Jerry @ 2018-07-19  2:40 UTC (permalink / raw)


On Wednesday, July 18, 2018 at 2:09:49 PM UTC-7, Dan'l Miller wrote:
> 
> Btw, MacOS happens to have a (historically) BSD kernel (that is now somewhat heavily modified), but MacOS, especially as the personality presented in userspace, is truly a rather divergent not-terribly-Unix OS called Dylan.

BSD kernel --> Doesn't it use Mach?
Dylan --> Do you not mean Darwin?

Dylan https://en.wikipedia.org/wiki/Dylan_(programming_language) was a new language that Apple developed. I think that Dylan was one of the many projects that were painfully dropped after Steve Jobs returned and pulled Apple out of the sh*tter. Does anyone remember the object-oriented OS that Apple and IBM were co-developing called Pink?

Jerry

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-17  1:20 How to run a GNAT program without starting a terminal session Jerry
                   ` (3 preceding siblings ...)
  2018-07-17 18:21 ` Shark8
@ 2018-07-19  2:57 ` Jerry
  2018-07-19  7:20   ` Björn Lundin
  4 siblings, 1 reply; 39+ messages in thread
From: Jerry @ 2018-07-19  2:57 UTC (permalink / raw)


On Monday, July 16, 2018 at 6:20:50 PM UTC-7, Jerry wrote:
> How can I get Ada (GNAT) to run a program that has no text I/O without launching a terminal session? Specifically, on macOS, I have the following program. When I double-click it, it runs but first it opens Terminal.app and starts a session. I played with calling it from Applescript but without success. Can I make a bash file that doesn't start a terminal session?
> 
> 
> with Ada.Calendar; use Ada.Calendar;
> with Common; -- Contains "Beep".
> 
> procedure Run is
> begin
>     Delay 4.0;
>     Common.Beep(1);
> end Run;
> 
> 
> Jerry

It looks like there is no easy answer to the original question, how to run a GNAT program without a terminal, but here is a solution to my immediate problem with some do-dads added. Sorry, it's not Ada. It's Applescript. The Applescript compiler bundles this up nicely as a double-clickable application bundle and does what I want. (The dialog box at the end is a little gratuitous.) afplay plays any audio file.


delay 30
do shell script "afplay '/System/Library/Sounds/Frog.aiff'"
delay 15
do shell script "afplay '/System/Library/Sounds/Ping.aiff'"
delay 13
beep
delay 1
beep
delay 1
beep
say "Stop running Jerry" volume 0.5
display dialog "Stop running!" buttons {"OK"} default button 1


What is this piece of silliness? For some time I have taken seriously the claim that sitting for long periods of time is unhealthy, and consequently I set my computer to announce the time every half hour at which time I am *supposed* to get up and run in place for one minute. I believe that this is a simple version of interval training and can actually cause me to lose a little weight. The problem is that I have to watch an analog on-screen clock to see when to stop and this does not always have a background that makes the clock easy to see, plus I have to stick next to the computer. Using a utility, I launch this program with a simple key combination.

Jerry

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-19  2:40           ` Jerry
@ 2018-07-19  3:19             ` Dan'l Miller
  0 siblings, 0 replies; 39+ messages in thread
From: Dan'l Miller @ 2018-07-19  3:19 UTC (permalink / raw)


On Wednesday, July 18, 2018 at 9:40:18 PM UTC-5, Jerry wrote:
> On Wednesday, July 18, 2018 at 2:09:49 PM UTC-7, Dan'l Miller wrote:
> > 
> > Btw, MacOS happens to have a (historically) BSD kernel (that is now somewhat heavily modified), but MacOS, especially as the personality presented in userspace, is truly a rather divergent not-terribly-Unix OS called Dylan.
> 
> BSD kernel --> Doesn't it use Mach?
> Dylan --> Do you not mean Darwin?
> 
> Dylan https://en.wikipedia.org/wiki/Dylan_(programming_language) was a new language that Apple
> developed. I think that Dylan was one of the many projects that were painfully dropped after Steve Jobs
> returned and pulled Apple out of the sh*tter. Does anyone remember the object-oriented OS that Apple
> and IBM were co-developing called Pink?
> 
> Jerry

Sorry, yes, I meant Darwin, as even I occasionally mention in prior c.l.a postings about my ARM-Apple-Darwin yearned-for LLVM target for Ada, which is the missing piece for me to switch all of my multiplatform iOS/MacOS/Windows10/Android-JNI-to-JVM-UI development to Ada2012 instead of C++14. 

I really really shouldn't multitask.  In another window, regarding Julia potentially emerging as a Python replacement, I was writing a separate private email to someone else about Julia's unfortunate lack of static type system like infamous Dylan's unfortunate lack of static type system but unlike Fortress's static type system.
https://en.wikipedia.org/wiki/Julia_(programming_language)#Language_features

Another gaff:  I wrote “parent UID” a few replies ago where fixed UID and fixed parent-PID should have been discussed separately.

And yes, Pink was where Taligent taught the C++ world about mix-in inheritance as the •only• useful restricted(-via-idiomatic-self-discipline) form of C++ multiple inheritance, as borrowed from the Lisp-family language Flavors, where pure-interface is captured via inheritance (i.e., without any nonzero-length extension to the record).  Nowadays we almost all call it “interface inheritance” instead of mix-in, forgetting the Flavors, Taligent, and Pink seminal references of yesteryear predating Java.

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-18 21:18         ` Jeffrey R. Carter
@ 2018-07-19  6:59           ` Jerry
  2018-07-19 15:25             ` Dennis Lee Bieber
  2018-07-19 16:50             ` Jeffrey R. Carter
  0 siblings, 2 replies; 39+ messages in thread
From: Jerry @ 2018-07-19  6:59 UTC (permalink / raw)


On Wednesday, July 18, 2018 at 2:18:31 PM UTC-7, Jeffrey R. Carter wrote:
> Several techniques are discussed here:
> 
> https://superuser.com/questions/360247/run-a-shell-script-on-os-x-without-having-a-terminal-window-appear#612072
> 
> Platypus is one of them.

Thanks for that.

The Automator suggestion works just like trying to call the shell command from an Applescript--I think it's pretty much the same thing; the app seems to run, delaying for the total of several delay commands, but does not emit any sound.

However, my "Beep" function uses Character'val(7), the ASCII bell--macOS normally interprets this to play the default system sound which for some reason is not making it to my speakers when run from Automator/Applescript but does work when run from terminal. But I have a function called Execute_Shell() which binds to the C command like this: pragma Import(C, system). Then if I put

say hello

as the command string for Execute_Shell and drop it into the Automator workflow as described in your link, it _does_ work correctly. Applescript probably gets the same result.

The Alfred method looks interesting but I'm not going to try it out right now.

The method using the line

/usr/bin/automator /path/to/the/file.workflow

Also works the same--"say" works but not playing ASCII bell. However, it requires launching from a terminal.

Sort-of-bottom-line: Calling the Ada executable in Applescript or Automator without invoking a terminal will allow "say" and probably "afplay" to work but not ASCII bell . ASCII bell works when executing Ada from a terminal and also "say" and probably "afplay".

Jerry


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-19  2:57 ` Jerry
@ 2018-07-19  7:20   ` Björn Lundin
  2018-07-19 11:30     ` Jerry
  0 siblings, 1 reply; 39+ messages in thread
From: Björn Lundin @ 2018-07-19  7:20 UTC (permalink / raw)


On 2018-07-19 04:57, Jerry wrote:
> On Monday, July 16, 2018 at 6:20:50 PM UTC-7, Jerry wrote:
>> How can I get Ada (GNAT) to run a program that has no text I/O without launching a terminal session? Specifically, on macOS, I have the following program. When I double-click it, it runs but first it opens Terminal.app and starts a session. I played with calling it from Applescript but without success. Can I make a bash file that doesn't start a terminal session?
>>
>>
>> with Ada.Calendar; use Ada.Calendar;
>> with Common; -- Contains "Beep".
>>
>> procedure Run is
>> begin
>>     Delay 4.0;
>>     Common.Beep(1);
>> end Run;
>>
>>
>> Jerry
> 
> It looks like there is no easy answer to the original question, how to run a GNAT program without a terminal, but here is a solution to my immediate problem with some do-dads added. Sorry, it's not Ada. It's Applescript. The Applescript compiler bundles this up nicely as a double-clickable application bundle and does what I want. (The dialog box at the end is a little gratuitous.) afplay plays any audio file.
> 
> 
> delay 30
> do shell script "afplay '/System/Library/Sounds/Frog.aiff'"
> delay 15
> do shell script "afplay '/System/Library/Sounds/Ping.aiff'"
> delay 13
> beep
> delay 1
> beep
> delay 1
> beep
> say "Stop running Jerry" volume 0.5
> display dialog "Stop running!" buttons {"OK"} default button 1
> 
> 
> What is this piece of silliness? For some time I have taken seriously the claim that sitting for long periods of time is unhealthy, and consequently I set my computer to announce the time every half hour at which time I am *supposed* to get up and run in place for one minute. I believe that this is a simple version of interval training and can actually cause me to lose a little weight. The problem is that I have to watch an analog on-screen clock to see when to stop and this does not always have a background that makes the clock easy to see, plus I have to stick next to the computer. Using a utility, I launch this program with a simple key combination.
> 
> Jerry
> 

Ah. Applescript is kind of fun.
Until you want to do some advance stuff.
I used to script apple iTunes and iPhote with a python binding to
applescript. worked better than I thoufht.

Anyway, your usercase does sound like you want a daemon.
make it start at boot, and then run forever.
That is what launchctrl is about.

But the applescript soulution may be simpler, except for you need to
start it by yourdelf each time.



-- 
--
Björn

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-19  7:20   ` Björn Lundin
@ 2018-07-19 11:30     ` Jerry
  2018-07-19 16:40       ` Björn Lundin
  0 siblings, 1 reply; 39+ messages in thread
From: Jerry @ 2018-07-19 11:30 UTC (permalink / raw)


On Thursday, July 19, 2018 at 12:20:57 AM UTC-7, björn lundin wrote:
> On 2018-07-19 04:57, Jerry wrote:
> > On Monday, July 16, 2018 at 6:20:50 PM UTC-7, Jerry wrote:
> >> How can I get Ada (GNAT) to run a program that has no text I/O without launching a terminal session? Specifically, on macOS, I have the following program. When I double-click it, it runs but first it opens Terminal.app and starts a session. I played with calling it from Applescript but without success. Can I make a bash file that doesn't start a terminal session?
> >>
> >>
> >> with Ada.Calendar; use Ada.Calendar;
> >> with Common; -- Contains "Beep".
> >>
> >> procedure Run is
> >> begin
> >>     Delay 4.0;
> >>     Common.Beep(1);
> >> end Run;
> >>
> >>
> >> Jerry
> > 
> > It looks like there is no easy answer to the original question, how to run a GNAT program without a terminal, but here is a solution to my immediate problem with some do-dads added. Sorry, it's not Ada. It's Applescript. The Applescript compiler bundles this up nicely as a double-clickable application bundle and does what I want. (The dialog box at the end is a little gratuitous.) afplay plays any audio file.
> > 
> > 
> > delay 30
> > do shell script "afplay '/System/Library/Sounds/Frog.aiff'"
> > delay 15
> > do shell script "afplay '/System/Library/Sounds/Ping.aiff'"
> > delay 13
> > beep
> > delay 1
> > beep
> > delay 1
> > beep
> > say "Stop running Jerry" volume 0.5
> > display dialog "Stop running!" buttons {"OK"} default button 1
> > 
> > 
> > What is this piece of silliness? For some time I have taken seriously the claim that sitting for long periods of time is unhealthy, and consequently I set my computer to announce the time every half hour at which time I am *supposed* to get up and run in place for one minute. I believe that this is a simple version of interval training and can actually cause me to lose a little weight. The problem is that I have to watch an analog on-screen clock to see when to stop and this does not always have a background that makes the clock easy to see, plus I have to stick next to the computer. Using a utility, I launch this program with a simple key combination.
> > 
> > Jerry
> > 
> 
> Ah. Applescript is kind of fun.
> Until you want to do some advance stuff.
> I used to script apple iTunes and iPhote with a python binding to
> applescript. worked better than I thoufht.
> 
> Anyway, your usercase does sound like you want a daemon.
> make it start at boot, and then run forever.
> That is what launchctrl is about.
> 
> But the applescript soulution may be simpler, except for you need to
> start it by yourdelf each time.
> 
> 
> 
> -- 
> --
> Björn

I _want_ to start it myself each time, approximately every 30 minutes, and it is designed to stop running after one minute. See my "running" post above.

The Applescript works perfectly but it's not Ada. :-( And I still don't know how to solve my original problem, how to run Ada program without a terminal session starting.

Jerry

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-19  6:59           ` Jerry
@ 2018-07-19 15:25             ` Dennis Lee Bieber
  2018-07-19 16:50             ` Jeffrey R. Carter
  1 sibling, 0 replies; 39+ messages in thread
From: Dennis Lee Bieber @ 2018-07-19 15:25 UTC (permalink / raw)


On Wed, 18 Jul 2018 23:59:47 -0700 (PDT), Jerry <list_email@icloud.com>
declaimed the following:


>However, my "Beep" function uses Character'val(7), the ASCII bell--macOS normally interprets this to play the default system sound which for some reason is not making it to my speakers when run from Automator/Applescript but does work when run from terminal. But I have a function called Execute_Shell() which binds to the ?C command like this: pragma Import(C, system). Then if I put
>

	If your Beep() is relying upon the \a ("alert")

>>> ord("\a")
7
>>> 

CHARACTER, then the function must be sending it to some I/O stream.
Typically it is the console (stdout), and producing a sound is the
responsibility of the console when it SEES the \a byte.

	If you run the program in some form that redirects stdout to a
bit-bucket or file (or to a text window that does NOT interpret ASCII
control codes) then nothing will trigger to play a sound -- it is just a
non-printable character..

>say hello
>
>as the command string for Execute_Shell and drop it into the Automator workflow as described in your link, it _does_ work correctly. Applescript probably gets the same result.

	What does "work correctly" mean here? {after a short bit of Google} Do
you mean the text shows up in a log window? Log windows likely do not
interpret most control codes (probably nothing beyond <new-line>). Or is
"say" a voice synthesizer? If so, it is the "say" command itself that is
driving the speakers.


https://stackoverflow.com/questions/7408785/is-there-a-way-to-play-a-system-beep-on-mac-os
{Note that pretty much all examples are "command line" -- ie;
console/terminal -- programs; nothing that does not have an attached
console}

https://stackoverflow.com/questions/3127977/how-to-make-the-hardware-beep-sound-in-mac-os-x-10-6
{Closest answer here is the response to use "afplay" with a sound file;
everything else is, again, console/terminal}



-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/ 


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-19 11:30     ` Jerry
@ 2018-07-19 16:40       ` Björn Lundin
  2018-07-19 20:46         ` Jerry
  0 siblings, 1 reply; 39+ messages in thread
From: Björn Lundin @ 2018-07-19 16:40 UTC (permalink / raw)


On 2018-07-19 13:30, Jerry wrote:
> I _want_ to start it myself each time, approximately every 30 minutes, and it is designed to stop running after one minute.
Ah, I misunderstood.
You want to know when you should stop running.
I suggested putting it as a daemon to signal when to START running.
A delay of 30 minutes would give you a beep twice an hour.

However if you are NOT at the computer - but running around - how could
the terminal app annoy you?
You are not there - except when you start it.
Does it not go away once your program is finished?

-- 
--
Björn

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-19  6:59           ` Jerry
  2018-07-19 15:25             ` Dennis Lee Bieber
@ 2018-07-19 16:50             ` Jeffrey R. Carter
  2018-07-19 20:47               ` Jerry
  1 sibling, 1 reply; 39+ messages in thread
From: Jeffrey R. Carter @ 2018-07-19 16:50 UTC (permalink / raw)


On 07/19/2018 08:59 AM, Jerry wrote:
> 
> Sort-of-bottom-line: Calling the Ada executable in Applescript or Automator without invoking a terminal will allow "say" and probably "afplay" to work but not ASCII bell . ASCII bell works when executing Ada from a terminal and also "say" and probably "afplay".

Since you're sending BEL to standard output, you need a standard output to send 
it to that responds to a BEL as you desire. When you run a program without a 
terminal, standard output is usually sent to a bit bucket. If you want to use 
BEL and get a sound, you'll need a terminal. If you don't want a terminal, 
you'll have to use something other than BEL, like afplay.

-- 
Jeff Carter
"They name the boy Jonathan Ralph Starkwell,
after Virgil's mother."
Take the Money and Run
141

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-19 16:40       ` Björn Lundin
@ 2018-07-19 20:46         ` Jerry
  2018-07-20  7:32           ` Björn Lundin
  0 siblings, 1 reply; 39+ messages in thread
From: Jerry @ 2018-07-19 20:46 UTC (permalink / raw)


On Thursday, July 19, 2018 at 9:40:20 AM UTC-7, björn lundin wrote:
> On 2018-07-19 13:30, Jerry wrote:
> > I _want_ to start it myself each time, approximately every 30 minutes, and it is designed to stop running after one minute.
> Ah, I misunderstood.
> You want to know when you should stop running.
> I suggested putting it as a daemon to signal when to START running.
> A delay of 30 minutes would give you a beep twice an hour.

My computer is already set to do that by announcing the time every half hour.
> 
> However if you are NOT at the computer - but running around - how could
> the terminal app annoy you?
> You are not there - except when you start it.
> Does it not go away once your program is finished?
Correct--it leaves an open terminal window indicated a completed session along with all the output that normally comes with a terminal session even if the user program doesn't add any. Maybe the result of some settings in my terminal preferences. In any case the program would always launch the terminal app which remains open even if I could figure out how to close each window.
> 
> -- 
> --
> Björn

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-19 16:50             ` Jeffrey R. Carter
@ 2018-07-19 20:47               ` Jerry
  0 siblings, 0 replies; 39+ messages in thread
From: Jerry @ 2018-07-19 20:47 UTC (permalink / raw)


On Thursday, July 19, 2018 at 9:50:24 AM UTC-7, Jeffrey R. Carter wrote:
> On 07/19/2018 08:59 AM, Jerry wrote:
> > 
> > Sort-of-bottom-line: Calling the Ada executable in Applescript or Automator without invoking a terminal will allow "say" and probably "afplay" to work but not ASCII bell . ASCII bell works when executing Ada from a terminal and also "say" and probably "afplay".
> 
> Since you're sending BEL to standard output, you need a standard output to send 
> it to that responds to a BEL as you desire. When you run a program without a 
> terminal, standard output is usually sent to a bit bucket. If you want to use 
> BEL and get a sound, you'll need a terminal. If you don't want a terminal, 
> you'll have to use something other than BEL, like afplay.
> 
Sounds right.
Jerry

Soun

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: How to run a GNAT program without starting a terminal session
  2018-07-19 20:46         ` Jerry
@ 2018-07-20  7:32           ` Björn Lundin
  0 siblings, 0 replies; 39+ messages in thread
From: Björn Lundin @ 2018-07-20  7:32 UTC (permalink / raw)


On 2018-07-19 22:46, Jerry wrote:
>> Does it not go away once your program is finished?
> Correct--it leaves an open terminal window indicated a completed session along with all the output that normally comes with a terminal session even if the user program doesn't add any. Maybe the result of some settings in my terminal preferences. In any case the program would always launch the terminal app which remains open even if I could figure out how to close each window.

If you _really_ want some of it in Ada
* create a bash script that runs then program.
* after the program is finished, use Applescript to close the terminal

something like 'tell Terminal to close'

but yes, it is a bit different...

There is a terminal setting to close the window if the program exited
without errors. But as you say the Terminal app would still run.
Unless told to close by applescript of course

-- 
--
Björn


^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2018-07-20  7:32 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-17  1:20 How to run a GNAT program without starting a terminal session Jerry
2018-07-17  4:35 ` Jerry
2018-07-17  9:55 ` AdaMagica
2018-07-17 10:08   ` Jerry
2018-07-17 10:23     ` Jerry
2018-07-17 13:13     ` Dennis Lee Bieber
2018-07-17 12:46 ` Björn Lundin
2018-07-17 16:20   ` Jeffrey R. Carter
2018-07-17 21:10     ` Jerry
2018-07-18  6:27       ` Jeffrey R. Carter
2018-07-19  1:41         ` Jerry
2018-07-19  2:31           ` Dennis Lee Bieber
2018-07-17 21:07   ` Jerry
2018-07-17 21:12     ` Shark8
2018-07-17 21:56       ` Jerry
2018-07-18  1:33         ` Shark8
2018-07-18  7:37       ` Björn Lundin
2018-07-18 16:41         ` Shark8
2018-07-18 21:18         ` Jeffrey R. Carter
2018-07-19  6:59           ` Jerry
2018-07-19 15:25             ` Dennis Lee Bieber
2018-07-19 16:50             ` Jeffrey R. Carter
2018-07-19 20:47               ` Jerry
2018-07-19  1:47         ` Jerry
2018-07-17 18:21 ` Shark8
2018-07-17 20:53   ` Jerry
2018-07-18 16:34     ` Shark8
2018-07-18 20:30       ` Björn Lundin
2018-07-18 21:09         ` Dan'l Miller
2018-07-18 21:41           ` Bill Findlay
2018-07-19  2:13             ` Dan'l Miller
2018-07-19  2:40           ` Jerry
2018-07-19  3:19             ` Dan'l Miller
2018-07-19  2:57 ` Jerry
2018-07-19  7:20   ` Björn Lundin
2018-07-19 11:30     ` Jerry
2018-07-19 16:40       ` Björn Lundin
2018-07-19 20:46         ` Jerry
2018-07-20  7:32           ` Björn Lundin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox