Difference between revisions of "Talk:Executing External Programs"

From Lazarus wiki
Jump to navigationJump to search
Line 27: Line 27:
 
Now, when I run it raises an error window with the saying:
 
Now, when I run it raises an error window with the saying:
 
   Project projet1 raised exception class 'External: SIGSEGV'
 
   Project projet1 raised exception class 'External: SIGSEGV'
 +
----
 +
:: If you don't give the option ''poUsePipes'', there are no streams to read from. [[User:Vincent|Vincent]] 02:16, 25 May 2005 (PDT)
  
 
When I click "OK", this windows opens:
 
When I click "OK", this windows opens:

Revision as of 11:16, 25 May 2005

Improved example didn't work for me

I copied the improved example and tried to compile it in lazarus 0.9.7 beta (Date: 22-05-05), using fpc version 2.0.0 [2005/05/16] for i386 - linux, and it gave me this error:

 project1.lpr(44,15) Error: identifier idents no member "Lines"
 project1.lpr(44,35) Error: Illegal expression
 project1.lpr(44,35) Fatal: Syntax error, ";" expected but "(" found


The line with error is:

 AStringList.Lines.ReadFromStream(AProcess.Output);

What's wrong ?

I fixed the example. Vincent 04:57, 23 May 2005 (PDT)

It compiles now, but when I run it freezes. Running step by step I found that it freezes at the line:

 AProcess.Execute;

From a console window, I saw the ppc386 process still running. Then I run 'killall ppc38' and the lazarus program unfroze, and the output.txt file had the right content.

I searched the web a little, and found and alternative way to set WaitOnExit, by changing it this way:

  // AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
  AProcess.WaitOnExit;

Now, when I run it raises an error window with the saying:

  Project projet1 raised exception class 'External: SIGSEGV'

If you don't give the option poUsePipes, there are no streams to read from. Vincent 02:16, 25 May 2005 (PDT)

When I click "OK", this windows opens:

  Execution Paused
  Adress: $08064782
  Procedure: CLASSES_TSTRINGS_$__LOADFROMSTREAM$TSTREAM
  File:
  (Some day an assembler window might popup here:)

I click "OK" again and it shows that the execution stopped at the line:

 AStringList.LoadFromStream(AProcess.Output);

Running step by step I confirm that it's this line that raised this excecption. What can I do ?