Sign in Join

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

Mailing lists / lazarus / 2009-04

TProcess

7 messages · 5 people ·

Reply by email Subscribe to this list Your subscription

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

Alex du Plessis

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

Reply by email

ik
to Alex du Plessis

How do you execute the TProcess ?
How do you pass the password ?

Ido

Alex du Plessis wrote 13 lines
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 http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090403/b6ef9a23/attachment-0001.html

Reply by email

闫程远
to ik

i think when you execute the process you should prompt for password and check if it's legal.
i mean there's a dialog for the user to enter the password.

2009/4/3 ik

Show quoted text 30 lines
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 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 > > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090403/9720afec/attachment.html

Reply by email

Alex du Plessis
to ik: How do you execute the TProcess ? How do you pass the password ? Ido -------------- next…

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 poStdErrtoOutput=TRUE

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 keyboard.

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 31 lines
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 < <mailto:>> 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 <mailto:> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus ------------------------------------------------------------------------ _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Christian Iversen
to Alex du Plessis: I am trying to run pg_dump on a PostgreSQL database. On the command line one can specify…
Alex du Plessis wrote
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.

A common way to do this is to enable IDENT authentication for PostgreSQL, so that a certain user (the backup user) is able to connect without a password, if connecting from localhost. That works quite well.

Maybe that's a possiblity?

Med venlig hilsen Christian Iversen

Reply by email

Alex du Plessis
to Christian Iversen
Christian Iversen wrote 15 lines
Alex du Plessis wrote: > 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. > A common way to do this is to enable IDENT authentication for PostgreSQL, so that a certain user (the backup user) is able to connect without a password, if connecting from localhost. That works quite well. Maybe that's a possiblity?

Thanx - I'll try that

Reply by email