Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert win32::process to fork need help

Status
Not open for further replies.

RedRooster

Programmer
Joined
Feb 18, 2002
Messages
1
Location
US
Any help would be greatly appreciated. I have never worked with fork before and I need to convert this win32 process to work on a Unix box. I think fork is the way to go but I am not sure where exactly to begin.

Here is the win32 code I have to convert. Any help or comments would be great. :)



#*****************RCP the Data File*********************************

Win32::Process::Create ($ProcessObj, $RCPExePath, $CmdLine, 1, DETACHED_PROCESS, $JustTrfrFilePath);
#Create a win32 process
$ProcessObj->SetPriorityClass (NORMAL_PRIORITY_CLASS); #set the priority
$ProcessObj->Wait(INFINITE); #wait until the process is finished
$ProcessObj->GetExitCode($ExitCode); #get the exit code, it should be 0 when successful
if ($ExitCode != 0) #RCP failed
{
print $SysOutPointer ("!!!!!!!!!!!!!!!!!!!!!!!!ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
print $SysOutPointer ("RCP failed to Upload Transfer file\n");
print $SysOutPointer ("!!!!!!!!!!!!!!!!!!!!!!!!ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
$ErrorStatus = $main::ConstRCPFailed;
}
else #create process worked!
{
print $SysOutPointer ("RCP Data file was successful\n");
}
 
Here's an example of how to use fork(), I don't know how to get the return code of the child process though...

if(fork()){
wait(); # wait for the child process to finish
} else {
# this is the child process, so do something
# and then just exit
exit();
}
# this is the parent again
# so carry on
Mike
"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top