>>
>I use API_APPRUN class to run pg_dump.exe file
>>>
>>>I need to show the messages from it after it finishes.
>>>
>>>How to capture standard output and redirect it to file ?>>
>>How about?
>>
>>
pg_dump.exe > log.txt
>>
>>then you inspect log.txt?
>
>And in case we need to capture stderr as well, here's a neat trick I already forgot twice, and had to google it out again:
>
>
pg_dump.exe > log.txt 2>err.txt
Thank you.
I forget to mention that I need need also:
1. Pass PGPASSWORD= environment variable to pg_dump (this seems to be the only way to pass password to pg_dump non-interactively). I modified APP_APPRUN to allow passing environment variables.
2. Capture exit code returned by pg_dump.exe to know that backup was completed OK.
How to implement those features ?
If this is not possible I think I can force user to enter password to run window and use some
IF ERRORLEVEL
statement to check for zero and non-zero errorlevel.
Do you have an example of checking errorlevel or idea how to pass password ?
Pg_dump.exe doc is here:
http://www.postgresql.org/docs/8.1/static/app-pgdump.html
Andrus