Question about tprocess from fpc

"Terry A. Haimann via fpc-pascal" <[email protected]>
Newsgroups gmane.comp.compilers.free-pascal.general
Message-ID <[email protected]>
I recently tried to execute a sed command from Lazarus, but didn't receive any output.  But when I imbedded the sed command in a script and then executed the script from tprocess, it worked fine.  Why is this?  I have run across similar issues from other Linux commands when trying to execute them from a Free Pascal program.  The work around I have found is to hide them in a script. Not pretty, but it works.

This was run on a i7-8700  and I am running Linux Mint 20.2 and am using Mate 1.24

Source Code

Function CaptureArtWork(b, e: LongInt): TStringList;
Var
   ArtProc:                TProcess;
   ArtSL:                  TStringList;
   i:                      LongInt;
Begin
     ArtProc  := TProcess.Create(nil);
     ArtSL := TStringList.Create;
     ArtProc.Executable := 'sed';
     ArtProc.Parameters.Add('-n');
     ArtProc.Parameters.Add('"' + IntToStr(b) + ',' + IntToStr(e) + 'p"');	
     ArtProc.Parameters.Add('MyFileName');
     ArtProc.Options := ArtProc.Options + [poWaitOnExit, poUsePipes];
     ArtProc.Execute;
     ArtSL.LoadFromStream(ArtProc.Output);
     ArtProc.Free;
     CaptureArtWork := ArtSL;
End;
-- 
Terry A. Haimann <[email protected]>
_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.