> Once more:
> Zero is a valid return value for read from a pipe.
>
> So it can perfectly be that read attempts 50 times returns 0, and only at
> read attempt 51 you get a positive result.
>
> That is why you must check isRunning, and not rely on the return value of
> readbytes.

Thank you, this is my new code and while it's working good on Windows
7 it doesn't on Windows XP :(.

procedure TBurpClient.Run;
begin
  fOurProcess.Options := [poUsePipes] + [poNoConsole];
  fOurProcess.Execute;
  while fOurProcess.Running do
  begin
    // make sure we have room
    fMemStream.SetSize(fBytesRead + READ_BYTES);
    // try reading it
    fNumBytes := fOurProcess.Output.Read((fMemStream.Memory +
fBytesRead)^, READ_BYTES);
    Inc(fBytesRead, fNumBytes);
  end;

  fMemStream.SetSize(fBytesRead);
  fOutputLines := TStringList.Create;
  fOutputLines.LoadFromStream(fMemStream);
  fOutputLines.SaveToFile('output.txt');
  CommandOutput := fOutputLines.Text;
  faStringList.Assign(fOutputLines);
  fObjectList.Add(fOutputLines);
  Inc(fIndexOfOL);
  Inc(fIndexOfOL);
//  fOutputLines.Free;
end;


-- 
Antonio Sanguigni alias slapshot
----------------------------------------------------------------------
Servizi informatici Windows e GNU/Linux- http://www.pieroni.biz
GioveLUG (Linux User Group) - http://www.giovelug.org
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to