[Lazarus] Console application does not close cleanly!

ik idokan at gmail.com
Sun Apr 10 22:32:57 CEST 2011


On Sun, Apr 10, 2011 at 22:20, Bo Berglund <bo.berglund at gmail.com> wrote:

> I was using Lazarus to create a console application for parsing out
> data from a network speed test program.
>
> In this case I used the Lazarus new project dialogue and specified a
> console application with all the defaults.
>
> This creates an application framework including command line parameter
> parsing, which is good. I use the cl to pass file names (input and
> output).
>
> My problem is this:
> I went to the section in DoRun where it states:
>  { add your program here }
>
> This is exatly what I did. The code parses out a report file and
> extracts the valid data, then writes it out to a file (append at end
> of that file) using TStringList.SaveToFile.
> This all works fine so far, but when this is done the code gets to the
> predefined statement:
>
>  // stop program loop
>  Terminate;
>
> And here I am getting an exception:
> External: SIGSEGV
>
> If I comment out Terminate then the program never ends....
>

It's a feature (the Terminate), not a bug.
The program is executed in a loop that parses data such as events and more
(regardless of it being terminal app).
Terminate "break" the loop and allow you to finish the execution.


>
> Is this specific to Ubuntu Linux or is it some error in my coding that
> causes this?
>
> I am using two objects in the DoRun, one TStringList and one object i
> created for parsing the data. Both are created and then freed in a
> try-finally construct before the Terminate call.
>
> All is fine up until this spot, the file is parsed and the result is
> written, yet I get the exception.
>
> Can someone please explain this?
>

Can you execute it with debug code and see where the crash happens ?


>
>
> --
> Bo Berglund
> Developer in Sweden
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>


Ido
LINESIP - Opening the source for communication
http://www.linesip.com
http://www.linesip.co.il
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110410/94d80f55/attachment-0003.html>


More information about the Lazarus mailing list