PgAgent 3.3.0 batch scripts on windows always get status failed

Поиск
Список
Период
Сортировка
От Bastiaan Olij
Тема PgAgent 3.3.0 batch scripts on windows always get status failed
Дата
Msg-id 5109D0E0.5000500@basenlily.me
обсуждение исходный текст
Ответы Re: PgAgent 3.3.0 batch scripts on windows always get status failed  (Dave Page <dpage@pgadmin.org>)
Список pgadmin-support
Hi All,

First post on this list so I hope I'm doing things right.
We've had a problem for awhile now that any batch script run by pgagent
on windows gets the status failed even if the batch file runs just fine.

I downloaded the latest copy of the source code to have a look and found
something strange in the code for Job::Execute in job.cpp

At the start of this method the variable succeeded gets set to false, in
the windows code it never gets set to true as apposed to the *nix code
where the variable rc is loaded with the return status of the batch
script and succeeded is assigned true if this status equals 0.

In the windows code (line 268) rc is set to 1, the return status of the
batch script is not returned. I do not know if this is done on purpose
and that as we can't detect if the script was successful succeeded is
left as failed or if not setting succeeded to true has simply been
overlooked?

I would suggest changing this code to:
268: // assume successful execution of script
269: rc = 0;
270: succeeded = true;

Alternatively, I'm assuming the code for CloseHandle is calling pclose,
the return value of pclose is the errorlevel returned by the batch
script and could be assigned to rc. I couldn't find the code for
CloseHandle so I'm not sure if it would be able to return this code but
if so the code could be turned into:
267: rc = CloseHandle(h_script);
268: if (rc == 0)
269:    succeeded = true;

Cheers,

Bastiaan Olij




В списке pgadmin-support по дате отправления:

Предыдущее
От: Dave Page
Дата:
Сообщение: Re: pgAdmin on MacOs: Cmd-s types 's' if there is nothing to save
Следующее
От: Chris Bartlett
Дата:
Сообщение: Re: 1.16.1: many operations cause display tree to collapse