[Lazarus] Is it possible to find the location of an EAccessViolation, with Lazarus?

Cyrax evvke at hotmail.com
Sun May 13 06:06:54 CEST 2018


On 12/05/18 21:04, Carlos E. R. via Lazarus wrote:
> On 2018-05-12 18:35, Orbán Árpád via Lazarus wrote:
>> Hi Carlos,
>>
>> Try add poUsePipes to TProcess.Options:
>>
>>>   AProcess := TProcess.Create(nil);
>>>      try
>>>         AProcess.Executable := '/usr/local/bin/egctl';
>>>         AProcess.Parameters.Add('Regleta');
>>>         AProcess.Parameters.Add('off');
>>>         AProcess.Parameters.Add('off');
>>>         AProcess.Parameters.Add('off');
>>>         AProcess.Parameters.Add('off');
>>
>>          AProcess.Options := AProcess.Options + [poUsePipes];
>>
>>>
>>>         AProcess.Execute;
> 
> Ah. Thanks. I had commented that out by mistake. Actual code was:
> 
>        {$ifDEF Dummy}
>        AProcess.Parameters.Add('Regleta');
>        AProcess.Options := [poWaitOnExit, poUsePipes];
>        {$else}
>        AProcess.Parameters.Add('Regleta');
>        AProcess.Parameters.Add('off');
>        AProcess.Parameters.Add('off');
>        AProcess.Parameters.Add('off');
>        AProcess.Parameters.Add('off');
>        {$endIf}
> 
> And "Dummy" was not defined.
> 
> Although the child is not using pipes :-?
> 
> 
> 

If the child process outputs something (text or something else), then it 
is using stdout pipe. And if you want access to this output, then you 
need to set poUsePipes enum in the TProcess.Options so TProcess can set 
up IO redirection correctly.

Also do not forget read TProcess.StdErr pipe, otherwise there is change 
for strange behaviour. Or add poStderrToOutPut to TProcess.Options.



More information about the Lazarus mailing list