Hi,
I am using the Perl 5.8.0 (Build 804) on Windows 2000 OS...I am facing a very weird problem..
I am using the Win32:rocess::Create for creating a process to extract the Jar information from a file using jar.exe which is kept in the JAVA_HOME\bin directory..
The code used to do is something like this:
open STDERR, ">error" ;
open STDOUT, ">extrackpkgname";
$appname = "$_MCenv_JAVA_HOME\\bin\\jar.exe";
$cmdline = "jar -tf $_MC_datajar";
$curdir = ".";
&startChildProcess("$appname","$cmdline","$curdir"
open (_MCifh_pkgname , "<extrackpkgname"
if ( -s "extrackpkgname" )
{
@_MCavar_pkgname = <_MCifh_pkgname>;
close _MCifh_pkgname;
chomp(@_MCavar_pkgname);
}
else
{
$_MCsvar_Error_Message = "Failed To Extract Package Information Of the jar '$_MC_datajar' ";
PrintErrLog( "$_MCsvar_Error_Message" );
returnToIF( "$_MCsvar_Process_Desc", "1", "$_MCdir_ErrorLogDir" );
}
foreach(....)
sub startChildProcess
{
my ($appname,$cmdline,$curdir) = @_;
my $process_obj;
Win32:rocess::Create($process_obj,$appname,$cmdline,1,NORMAL_PRIORITY_CLASS,$curdir);
$Pid = $process_obj->GetProcessID();
open( _MCifh_ , ">>$ENV{CLIENTDIR}\\appdata\\tmp\\processids.txt" );
if ( ! flock( _MCifh_ , 2|4))
{
$Error_Message = "Performing User Initiated Cancel Action";
PrintErrLog( "$Error_Message" );
returnToIF( "$Process_Desc", "1", "$ErrorLogDir" );
}
print _MCifh_ "$Pid\n" ;
close _MCifh_ ;
$process_obj->Wait(INFINITE);
}
Now what happens here is that the STDOUT file takes around 10-15 seconds to be created and by that time my control comes out of the
if ( -s "extrackpkgname" ) , without even detecting the existence of more than 0 KB file as a result of which my script fails.(i.e the control comes into the else part of if ( -s "extrackpkgname" ) as by that time that file has not been created, though after 10-15 the file gets created).The same script runs fine on other machine having the same OS and on my machine the problem creeps up everytime.
Can you suggest me the reason for the same and some corrective actions as well..
A fast response would highly be appreciated...
I am using the Perl 5.8.0 (Build 804) on Windows 2000 OS...I am facing a very weird problem..
I am using the Win32:rocess::Create for creating a process to extract the Jar information from a file using jar.exe which is kept in the JAVA_HOME\bin directory..
The code used to do is something like this:
open STDERR, ">error" ;
open STDOUT, ">extrackpkgname";
$appname = "$_MCenv_JAVA_HOME\\bin\\jar.exe";
$cmdline = "jar -tf $_MC_datajar";
$curdir = ".";
&startChildProcess("$appname","$cmdline","$curdir"
open (_MCifh_pkgname , "<extrackpkgname"
if ( -s "extrackpkgname" )
{
@_MCavar_pkgname = <_MCifh_pkgname>;
close _MCifh_pkgname;
chomp(@_MCavar_pkgname);
}
else
{
$_MCsvar_Error_Message = "Failed To Extract Package Information Of the jar '$_MC_datajar' ";
PrintErrLog( "$_MCsvar_Error_Message" );
returnToIF( "$_MCsvar_Process_Desc", "1", "$_MCdir_ErrorLogDir" );
}
foreach(....)
sub startChildProcess
{
my ($appname,$cmdline,$curdir) = @_;
my $process_obj;
Win32:rocess::Create($process_obj,$appname,$cmdline,1,NORMAL_PRIORITY_CLASS,$curdir);
$Pid = $process_obj->GetProcessID();
open( _MCifh_ , ">>$ENV{CLIENTDIR}\\appdata\\tmp\\processids.txt" );
if ( ! flock( _MCifh_ , 2|4))
{
$Error_Message = "Performing User Initiated Cancel Action";
PrintErrLog( "$Error_Message" );
returnToIF( "$Process_Desc", "1", "$ErrorLogDir" );
}
print _MCifh_ "$Pid\n" ;
close _MCifh_ ;
$process_obj->Wait(INFINITE);
}
Now what happens here is that the STDOUT file takes around 10-15 seconds to be created and by that time my control comes out of the
if ( -s "extrackpkgname" ) , without even detecting the existence of more than 0 KB file as a result of which my script fails.(i.e the control comes into the else part of if ( -s "extrackpkgname" ) as by that time that file has not been created, though after 10-15 the file gets created).The same script runs fine on other machine having the same OS and on my machine the problem creeps up everytime.
Can you suggest me the reason for the same and some corrective actions as well..
A fast response would highly be appreciated...