Console program does not end after terminal is closed!

Linux specific forum
User avatar
Mijikai
Addict
Addict
Posts: 1520
Joined: Sun Sep 11, 2016 2:17 pm

Console program does not end after terminal is closed!

Post by Mijikai »

Console program does not end after terminal is closed!
Is this normal (PB 6.20) ?

Code:

Code: Select all

EnableExplicit

Procedure.i main()
  If OpenConsole("")
    Input()
    CloseConsole()
  EndIf
EndProcedure

End main()
User avatar
mk-soft
Always Here
Always Here
Posts: 6244
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Console program does not end after terminal is closed!

Post by mk-soft »

What does not end.
The programme and the terminal window end here
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Mijikai
Addict
Addict
Posts: 1520
Joined: Sun Sep 11, 2016 2:17 pm

Re: Console program does not end after terminal is closed!

Post by Mijikai »

When i close the terminal the program stays open which is annoying (mlterm / cant set a different one).
infratec
Always Here
Always Here
Posts: 7616
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Console program does not end after terminal is closed!

Post by infratec »

Have you set the executable to console in compiler options?
User avatar
Mijikai
Addict
Addict
Posts: 1520
Joined: Sun Sep 11, 2016 2:17 pm

Re: Console program does not end after terminal is closed!

Post by Mijikai »

infratec wrote: Fri Apr 25, 2025 11:14 am Have you set the executable to console in compiler options?
Yes, otherwise i would not get a terminal and PrintN() would not work.
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: Console program does not end after terminal is closed!

Post by Marc56us »

It also depends on how the PB program was launched.
If it was launched from an already open shell and you want to close it too, send the shell command un*x “ exit ” (or Ctrl+D).
infratec
Always Here
Always Here
Posts: 7616
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Console program does not end after terminal is closed!

Post by infratec »

To be clear:

You start the executable in a terminal,
you close the terminal
and in an other terminal you can see with ps ax that the program is still running?
#NULL
Addict
Addict
Posts: 1499
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: Console program does not end after terminal is closed!

Post by #NULL »

Probably what Mijikai means is, if instead of pressing enter at the Input() you click X/close window button of the terminal window. The terminal window closes but in the IDE the program is still running and has to be killed.
User avatar
Mijikai
Addict
Addict
Posts: 1520
Joined: Sun Sep 11, 2016 2:17 pm

Re: Console program does not end after terminal is closed!

Post by Mijikai »

@#NULL is right, sorry i should have mentioned that i run it from the IDE. :oops:
Post Reply