Thanks for the fast answer. I suppose this should work, but i can't build the windows program, i tried to use cmake but didn't manage to make it work :( (This is for my work and we have Delphi under windows, a proxy that prevent to use git and a lot of restrictions :/ )
On Mon, Nov 22, 2010 at 1:59 PM, Dave Page <dp...@pgadmin.org> wrote: > On Mon, Nov 22, 2010 at 12:06 PM, Julien Rouhaud <rjuju...@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 >