Обсуждение: How to determine if psql returns ZERO to the "shell" and finished successfully?

Поиск
Список
Период
Сортировка

How to determine if psql returns ZERO to the "shell" and finished successfully?

От
"Tommy "
Дата:
Hello, 

I'm implementing a Setup Wizard to install PostgreSQL. In the documentation
it states that psql returns ZERO to the "shell" if it finished successfully.


I'm implementing a wizard in Pascal and was wondering the correct syntax to
check whether or not the shell received ZERO?
For example, 

If not (psql) then
MsgBox('Note: psql was not finished normally.', mbError, MB_OK);
How exactly can I check to see if psql returns ZERO to the "shell"? What do
I test for?  If(Psql.exe)? or is there a variable I can check to see if it
has been set?

Any suggestions would surely be appreciated. Thanks.




Re: How to determine if psql returns ZERO to the "shell" and finished successfully?

От
Andrew Dunstan
Дата:


Tommy wrote:
> Hello, 
>
> I'm implementing a Setup Wizard to install PostgreSQL. In the documentation
> it states that psql returns ZERO to the "shell" if it finished successfully.
>
>
> I'm implementing a wizard in Pascal and was wondering the correct syntax to
> check whether or not the shell received ZERO?
> For example, 
>
> If not (psql) then
> MsgBox('Note: psql was not finished normally.', mbError, MB_OK);
>  
> How exactly can I check to see if psql returns ZERO to the "shell"? What do
> I test for?  If(Psql.exe)? or is there a variable I can check to see if it
> has been set?
>
>   

You would check the same way you check for the exit status of any other 
command you spawn.

Since you haven't told us what OS this is nor how your wizard is calling 
psql, it's hard to say more.

cheers

andrew


Re: How to determine if psql returns ZERO to the "shell" and finished successfully?

От
Jorgen Austvik - Sun Norway
Дата:
Tommy wrote:
> How exactly can I check to see if psql returns ZERO to the "shell"? What do
> I test for?  If(Psql.exe)? or is there a variable I can check to see if it
> has been set?

If you are running Delphi on Windows (the MsgBox makes me guess so),
take a look here:
http://delphi.about.com/od/windowsshellapi/a/executeprogram.htm

-J
--

Jørgen Austvik, Software Engineering - QA
Database Technology Group

Sun Microsystems AS
Haakon VII gt. 7b
N-7485 Trondheim, Norway
Phone  +47 73 84 21 10
Fax    +47 73 84 21 01
Mobile +47 90 19 78 86

Вложения