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 -- Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-support