[Lazarus] send complex command to linux

silvioprog silvioprog at gmail.com
Sat Dec 18 19:57:31 CET 2010


2010/12/18 ugaciaka <ugaciaka at gmail.com>

> Hi,
>
> this is an example of what I do
> ===================================================
>
> procedure TfrmMain.btnConvertClick(Sender: TObject);
> var
>  enumFile : TStringsEnumerator;
>  AProcess: TProcess;
>  AStringList: TStringList;
> begin
>  enumFile := clbFile.Items.GetEnumerator;
>  AProcess := TProcess.Create(nil);
>  AStringList := TStringList.Create;
>
>  while enumFile.MoveNext do
>  begin
>    AProcess.CommandLine := 'flac -cd /home/ugaciaka/prova/prova.flac
> + | lame -h -b 320 - /home/ugaciaka/prova.mp3';
>

Try:

AProcess.CommandLine := 'sh -c "flac -cd /home/ugaciaka/prova/prova.flac + |
lame -h -b 320 - /home/ugaciaka/prova.mp3"';

Tip:

http://code.google.com/p/lazsolutions/source/browse/trunk/Core/LSUtils.pas?r=177#34


>    AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
>    AProcess.Execute;
>    AStringList.LoadFromStream(AProcess.Output);
>    AStringList.SaveToFile('output.txt');
>  end;
>  AStringList.Free;
>  AProcess.Free;
> end;
> ====================================================================
> but not function, *but* if I write
>
> AProcess.CommandLine := 'firefox gmail.google.com';
>
> my process running correctly firefox.
>
> In first case output.exe is similar to only ouput "lame".
>
> Any resolution?
>
> tnx
>
> ugaciaka
>

-- 
Silvio Cl├ęcio,
*programmer* *ObjectPascal*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20101218/bcee50da/attachment-0003.html>


More information about the Lazarus mailing list