[fpc-pascal] TProcess and EProcess

Michael Van Canneyt michael at freepascal.org
Wed Mar 15 09:40:05 CET 2006



On Wed, 15 Mar 2006, Adrian Maier wrote:

> Hello,
>
> I am trying to catch the possible exceptions that may ocur
> when executing processes with TProcess (such as cases when
> the program doesn't exist or is not in the path).
>
>   try
>      p := TProcess.Create(nil);
>      p.CommandLine := 'psql';
>      p.Options := p.Options + [poStderrToOutPut,poNewConsole,poWaitOnExit];
>      p.Execute;
>
>   except
>      on EProcess do ShowMessage('EProcess !');
>      else
>         ShowMessage('Mysterious exception, other than EProcess ...' );
>   end;
>
> The compiler tells me that it doesn't recognize EProcess.
> What am I doing wrong?

it should be:

      on E : EProcess do ShowMessage('EProcess !');

Michael.



More information about the fpc-pascal mailing list