Terminal closes too quickly

Linux specific questions.
sancho3
Posts: 285
Joined: Sep 30, 2017 3:22

Terminal closes too quickly

Postby sancho3 » Mar 28, 2018 3:34

The terminal window fills with text that can only be some kind of error but it happens after the last sleep command in my program.
It shuts immediatly and I can't figure out what it is saying. I can't retrieve that window.
I have tried compiling from the terminal but it doesn't fill the terminal with text in that case.
How do I stop that terminal window from closing after my run?
Ubuntu
Last edited by sancho3 on Mar 28, 2018 4:55, edited 1 time in total.
caseih
Posts: 1297
Joined: Feb 26, 2007 5:32

Re: Terminal closes too quickly

Postby caseih » Mar 28, 2018 4:41

What operating system? Since you use the word Terminal I'm assuming Linux. In order to keep the terminal window open you need to run your application from the terminal prompt.
sancho3
Posts: 285
Joined: Sep 30, 2017 3:22

Re: Terminal closes too quickly

Postby sancho3 » Mar 28, 2018 5:47

Thanks.
I found the error in my program.
It seems rather pointless to fill a terminal window with debug info and then shut it down.
Running from terminal gives one line error, Segmentation violation. Its some help, but not much.
D.J.Peters
Posts: 7429
Joined: May 28, 2005 3:28

Re: Terminal closes too quickly

Postby D.J.Peters » Mar 28, 2018 13:18

sancho3 wrote:Running from terminal gives one line error, Segmentation violation. Its some help, but not much.
If you need more info try this:
fbc -exx yourcode.bas
./yourcode

or use the debugger:

fbc -g yourcode.bas
gdb ./yourcode
[r] <-- means press r for run

Joshy
Dinosaur
Posts: 1090
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

Re: Terminal closes too quickly

Postby Dinosaur » Mar 28, 2018 14:05

Hi All

If you need more info try this:
fbc -exx yourcode.bas
./yourcode

Another note for my Linux tricks notebook.

I had only ever used -exx to check for array bounds.
Whenever I tried to run the program compiled with -exx with Win or Dos it would hang or not run.
Mind you this was years ago.

Actually found an error that has gone unnoticed when I just tested this.
Thank you Joshy

Regards
caseih
Posts: 1297
Joined: Feb 26, 2007 5:32

Re: Terminal closes too quickly

Postby caseih » Mar 28, 2018 14:25

Definitely essential tips from Joshy. During the development phase, -exx should always be used, as should -g. And you should always run your app from the terminal also. Don't rely on double-clicking an icon as you'll miss vital information. I'm a bit surprised you even saw a terminal window pop up. On my desktop, double-clicking an executable runs it without any standard I/O streams at all, which means a non-graphical FB program would probably do appear to do nothing at all. On your distro it must be defaulting to running executables in a terminal window, which is reasonable for normal terminal apps I suppose.

One thing I like about Linux over Windows is that all applications can use standard out and standard error, but it's always hidden unless you run it from a terminal directly. This is great as normal users would never see or be bothered by information, but if someone wants it, it's there when they run it from a terminal. Unlike Windows where if you use standard out or standard error at all, it pops up an annoying console window. This means you have to make your program completely silent for production applications.
jj2007
Posts: 847
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Terminal closes too quickly

Postby jj2007 » Mar 28, 2018 16:04

caseih wrote:One thing I like about Linux over Windows is that all applications can use standard out and standard error, but it's always hidden unless you run it from a terminal directly. This is great as normal users would never see or be bothered by information, but if someone wants it, it's there when they run it from a terminal. Unlike Windows where if you use standard out or standard error at all, it pops up an annoying console window. This means you have to make your program completely silent for production applications.
On Windows, you can build it as a gui app and then use AllocConsole if a switch is present.
Alternatively, you can build as a console app and use FreeConsole to get rid of the console.
badidea
Posts: 964
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Terminal closes too quickly

Postby badidea » Mar 28, 2018 16:58

With Geany you can do this (Linux or Windows):
Image
Now, in this case:
F8 = Compile with extra checks
F9 = 'Normal' compile (faster)
F5 = Run
Kuan Hsu
Posts: 399
Joined: Sep 16, 2007 15:12
Location: Taiwan

Re: Terminal closes too quickly

Postby Kuan Hsu » Mar 28, 2018 18:02

sancho3
Posts: 285
Joined: Sep 30, 2017 3:22

Re: Terminal closes too quickly

Postby sancho3 » Mar 29, 2018 1:56

Good tip about GDL, I forgot I could use that from the terminal or even in the IDE.
I did use -exx. I absolutely use that all the time. I am running from within the IDE (poseiden on Ubuntu) normally, and FB produces a terminal window and a graphic window if you use screenres.
In this case the terminal window was filling with debug info and running from the command line would only give the limited error message.
At the end of the day the problem was in a destructor and if I had been diligent I would have found it much sooner.

Return to “Linux”

Who is online

Users browsing this forum: No registered users and 2 guests