On Fri, 14 Dec 2007, el stamatakos wrote:

> 
> Hi All,
>  I am having real problems getting my app to run using TProcess. I have a 
> procedure that encapsulates process like below
> 
> procedure TMainForm.ExecNewProcessNoDir(app,cmd: string; Wait: Boolean);
> var
>    AProcess: TProcess;
> begin
>    AProcess := TProcess.Create(nil);
>  try
>    Aprocess.ShowWindow := swoShowNormal;
>     if cmd <> '' then
>     AProcess.CommandLine := app+' '+cmd
>      else AProcess.CommandLine := app;
>    if wait = True then
>        AProcess.Options := AProcess.Options + [poWaitOnExit];
>    AProcess.Execute;
>  finally
>    AProcess.Free;
>  end;
> end;       
> 
> Now I call the procedure as follows using the following arguments
>  app:='/cadtools/linux/ecsConverter/source/converter.pl';
> cmd:= Dir1+' -pdk '+Dir2+' -def> Conv.log';
>   MainForm.ExecNewProcessNoDir(app,cmd,true);
> 
> Where Dir1 and Dir2 are directories. If I explicitly write the paths for Dir1 
> and Dir2 so I pass
> cmd:='/home/lefti/test/rev -pdk /etc/test/rev -defMulti> ecsConverter.log'
> this works ok. I recall one user said that cmd does not understand + and all 
> that. The question is how do I pass variables since I cannot hard wire
> cmd.
> All the help is much appreciated. Thanks

The problem is ">Conv.log", that will not work. 

Redirection is handled by the shell, not by TProcess. 
If you want redirection, I suggest you execute

sh -c "/cadtools/linux/ecsConverter/source/converter.pl /home/lefti/test/rev 
-pdk /etc/test/rev -defMulti >conv.log"

Maybe in time we should add a property 'outputfile' or so, which takes care of 
the
redirecton. If someone is interested in writing this extension, I'll be glad to 
accept patches.

Michael.

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to