Peterson, Darren - Contractor.Westar wrote:
> I'm trying to use fork and exec to kick-start other processes on a
> Linux box.  As with Win32::Process::Create, I'd like to somehow
> specify or point towards a working directory for the new process
> since some data files are expected via relative path.  I actually
> tried passing a compound command such as "cd
> /home/otbsaf/OTBSAF/src/OTBSAF;./otbsaf" to exec to hope a directory
> switch would happen as I intended.  The new process displays its
> current directory and the directory shown was that from which the
> perl script was running, not the hoped for otbsaf. 

Just use Perl's chdir() after you fork:

  defined(my $pid = fork) or die $!;
  unless ($pid) {
      chdir('/home/otbsaf/OTBSAF/src/OTBSAF') or die $!;
      exec './otbsaf' or die $!;
  }

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to