in reply to Re: The return code from Perl is not returned to the application
in thread The return code from Perl is not returned to the application
I am sorry for the delay in my response.
>an example of how you are exiting the Perl script (i.e. are you using exit?)
Yes, I am using exit like folloing code.
---- perl script ---- #unlock the file and output the log &exit_instance; #return exit code to C program. POSIX:_exit($ret ? EXIT_SUCCESS : EXIT_FAILURE); ---- perl script ----
---- Daemon ----
if( TRUE != CreateProcess( NULL, commandLine, &sa, &sa, TRUE, CREATE_NEW_PROCESS_GROUP | NORMAL_PRIORITY_CLASS, NULL, NULL,
&StartInfo, &ProcInfo ) ) {
dRet = GetLastError();
LOGOUTPUT_ERR_WITHNUM_WIN( 0, MS_M_CREATEPROC_E, dRet );
return dRet;
}
---- Daemon ----
---- C program ----
#szCmd means perl command
if (-1 == (ret = system(szCmd))) {
err = errno;
printf("Execution failure.%d\n", err);
return EXIT_FAILURE;
}
return ret;
---- C program ----
As an image, look at the following flow.
1. daemon -(launch)-> C program(1)
-(launch)-> C program(2)
-(launch)-> C program(3)
2. C program(1) -(launch)-> perl script(1)
C program(2) -(launch)-> perl script(2)
C program(3) -(launch)-> perl script(3)
3. perl script(1) -> get information from ESX server and write it to text
perl script(2) -> wait for information about ESX server(i.e. wait until perl script(1) write a text)
perl script(3) -> wait for information about ESX server(i.e. wait until perl script(1) write a text)
4. after (3), each perl script process get information from text, and analyze it.
As I already wrote, perl script outputs the logs at the start and the end of operation.
|
|---|