For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > November 2005 > PID from FORK doesn't match the PID on WINDOWS.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PID from FORK doesn't match the PID on WINDOWS.
travis.masters@wachovia.com

2005-11-07, 9:55 pm

Hi all,

I'm running a cgi script on Windows and I'm trying to capture the PID
from a child process using SYSTEM(). What I have found from other
topics in perl.beginners seems to recommend using FORK with EXEC. I
have tried this code and the PID returned from the CGI doesn't match
the PID listed on TaskMgr for Windows. In fact it doesn't match any
PID (parent or child) or any process running. Can anyone provide the
code to capture the PID of a child using FORK, EXEC, or SYSTEM?
Thanks.

#!/bin/perl
use strict;
use warnings;

my $prog = 'some_executable';

my $pid = fork();
unless ($pid) {
exec($prog);
die "Can't start $prog: $!";
}

print "Pid is $pid\n";

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com