--- execute.c 2011-09-01 11:55:36.000000000 +0400 +++ execute.c.corect 2011-09-03 11:40:19.409577000 +0400 @@ -283,6 +283,13 @@ goto close; } + /* Ensure the read handle to the pipe for STDOUT is not inherited. */ + if ( ! SetHandleInformation(hRead, HANDLE_FLAG_INHERIT, 0) ) + { + zbx_snprintf(error, max_error_len, "Unable to SetHandleInformation: %s", strerror_from_system(GetLastError())); + } + + /* create a new job where the script will be executed */ if (0 == (job = CreateJobObject(&sa, NULL))) { @@ -348,7 +355,6 @@ else ret = SUCCEED; - CloseHandle(pi.hProcess); CloseHandle(pi.hThread); if (FAIL == ret) @@ -370,6 +376,8 @@ } } close: + CloseHandle(pi.hProcess); + if (NULL != job) { /* terminate the child process and it's childs */