[SOLVED} Issue with TProcess and top lazarus / 32-Linux ---------------------------------------------------------------------- Barry55 · 2021-01-23 17:35 I am trying to use TProcess to get some information about what is happening on my Raspberry pi. Some of it is working fine. the following code is OK Var   AProcess        : TProcess;   AStringList     : TStringList;   ResultStr        : String; Begin   AStringList := TStringList.Create;   AProcess := TProcess.Create(nil);   ResultStr := '';   Try     AProcess.Executable := 'vcgencmd';     Aprocess.Parameters.Add('measure_temp');     AProcess.Options := [poWaitOnExit, poUsePipes];     AProcess.Execute;     AStringList.LoadFromStream(AProcess.Output);     ResultStr := AStringList.Text;   finally     AStringList.Free;     AProcess.Free;   end; and I get the information I expected in ResultStr. However if I try the following   AStringList := TStringList.Create;    AProcess := TProcess.Create(nil);    ResultStr := '';    Try      AProcess.Executable := '/usr/bin/top';      Aprocess.Parameters.Add('-n 1 -p0');      AProcess.Options := [poWaitOnExit, poUsePipes];      AProcess.Execute;      AStringList.LoadFromStream(AProcess.Output);      ResultStr := AStringList.Text;    finally      AStringList.Free;      AProcess.Free;    end; ResultStr is always empty. I assume it might be something to do with top clearing the screen before it starts but I am not sure how to get round this and wondered if anyone had any ideas. Many thanks Regards Barry ---------------------------------------------------------------------- Barry55 · 2021-01-23 18:09 Sorry - went back to the documentation and found the issue, I needed to do this to make it work    AStringList := TStringList.Create;    AProcess := TProcess.Create(nil);    ResultStr := '';    Try      AProcess.Executable := '/usr/bin/top';      Aprocess.Parameters.Add('-n1');      Aprocess.Parameters.Add('-p0');;      Aprocess.Parameters.Add('-b');      AProcess.Options := [poWaitOnExit, poUsePipes];      AProcess.Execute;      AStringList.LoadFromStream(AProcess.Output);      ResultStr := AStringList.Text;    finally      AStringList.Free;      AProcess.Free;    end; Barry ---------------------------------------------------------------------- PascalDragon · 2021-01-24 11:05 In the future please use code tags. This results in better readability here on the forum and avoids the forum software potentially messing up code.