Re: PgAgent - return code on batch step on Windows
| От | Dave Page |
|---|---|
| Тема | Re: PgAgent - return code on batch step on Windows |
| Дата | |
| Msg-id | AANLkTi=WbaKasCjyxRGpHdUgzdJcN6KTE6zJ62_maFzz@mail.gmail.com обсуждение исходный текст |
| Ответ на | PgAgent - return code on batch step on Windows (Julien Rouhaud <rjuju123@gmail.com>) |
| Ответы |
Re: PgAgent - return code on batch step on Windows
|
| Список | pgadmin-support |
On Mon, Nov 22, 2010 at 12:06 PM, Julien Rouhaud <rjuju123@gmail.com> wrote: > Hi pgadmin team. > > I got a problem with PgAgent on Windows : > When I create a batch step, the status is always set to succeed, even if the > batch doesn't work. > > I found this in the source code (job.cpp) : > > #ifdef __WIN32__ > // The Windows way > HANDLE h_script; > DWORD dwRead; > char chBuf[4098]; > > h_script = win32_popen_r(filename.wc_str()); > [...] > CloseHandle(h_script); > rc=1; > #else > // The *nix way. > [...] > rc=pclose(fp_script); > rc = (unsigned char)(rc >> 8); // The exit code is in the top 8 bits > rc = (signed char)rc; > > the return code seems to be always true on windows platform, as the > CloseHandle return code is not used ? > Hope that'll help. CloseHandle is a generic function that returns a boolean indicating whether or not the handle was closed - it really doesn't tell us anything useful about what happened, unlike pclose(). Does something like this work? diff --git a/job.cpp b/job.cpp index 0611c93..08feb17 100644 --- a/job.cpp +++ b/job.cpp @@ -258,9 +258,8 @@ int Job::Execute() } } - + GetExitCodeProcess(h_script, (LPDWORD)&rc); CloseHandle(h_script); - rc=1; #else // The *nix way. -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgadmin-support по дате отправления: