Page 1 of 1
Console program does not end after terminal is closed!
Posted: Thu Apr 24, 2025 5:36 pm
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()
Re: Console program does not end after terminal is closed!
Posted: Thu Apr 24, 2025 6:49 pm
by mk-soft
What does not end.
The programme and the terminal window end here
Re: Console program does not end after terminal is closed!
Posted: Thu Apr 24, 2025 7:07 pm
by Mijikai
When i close the terminal the program stays open which is annoying (mlterm / cant set a different one).
Re: Console program does not end after terminal is closed!
Posted: Fri Apr 25, 2025 11:14 am
by infratec
Have you set the executable to console in compiler options?
Re: Console program does not end after terminal is closed!
Posted: Fri Apr 25, 2025 1:48 pm
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.
Re: Console program does not end after terminal is closed!
Posted: Fri Apr 25, 2025 2:48 pm
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).
Re: Console program does not end after terminal is closed!
Posted: Fri Apr 25, 2025 3:09 pm
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?
Re: Console program does not end after terminal is closed!
Posted: Fri Apr 25, 2025 4:12 pm
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.
Re: Console program does not end after terminal is closed!
Posted: Fri Apr 25, 2025 4:39 pm
by Mijikai
@#NULL is right, sorry i should have mentioned that i run it from the IDE.
