Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2006-03

TProcess and EProcess

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Adrian Maier

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?

Thanks,
Adrian Maier

Michael Van Canneyt
to Adrian Maier
Adrian Maier wrote 20 lines
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.