[Lazarus] TProcess

Alex du Plessis alexdup01 at telkomsa.net
Fri Apr 3 15:11:20 CEST 2009

I am trying to run pg_dump on a PostgreSQL database. On the command line 
one can specify the user name but not the password.  Once the process is 
running pg_dump requests the password inside the console window.  there 
is no commandline option to pass the password to the program.

I can get the process to run and once the password is entered in the 
console - the backup proceeds without a hitch.  Please note: The 
password is only required once pg_dump is already running in the 
console. I even retrieve the output from the console (using the code as 
proposed in the Lazarus Wiki) into a TMemo and it works like a dream.  I 
just cannot seem to communicate with pg_dump once the console is running.

I set the commandline to the appropriate command e.g. "%spg_dump.exe 
--host localhost --port 5432 --username postgres --format custom --blobs 
--oids --verbose --file "%s" mobman'
The %s i add when I know what the relevant directories and filenames are 
just before execution.

Then I do "Tprocess.Execute" with options poWaitOnExit=FALSE and 

No problem with that ...I just can't pass the password into the console 
once pg_dump is running except for typing it into the console via the 

As this will be an automated database backup, having to type the 
password is not an option as the client would not even know the password 
for the db server.

ik wrote:
> How do you execute the TProcess ?
> How do you pass the password ?
> Ido
> On Fri, Apr 3, 2009 at 2:05 PM, Alex du Plessis 
> <alexdup01 at telkomsa.net <mailto:alexdup01 at telkomsa.net>> wrote:
>     I am trying to run a program which requires a password inside
>     TProcess.   However, I cannot seem to pass this password from my
>     Lazarus
>     App to the process once it is running.  Does anybody know how to go
>     about it?
>     Thanx
>     Alex du Plessis
>     _______________________________________________
>     Lazarus mailing list
>     Lazarus at lazarus.freepascal.org <mailto:Lazarus at lazarus.freepascal.org>
>     http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
> ------------------------------------------------------------------------
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

More information about the Lazarus mailing list