in reply to system() call failure
here's the bare bone of my code which forks the child process. I also added some debug messages.
===
sub fork_job { my $job = shift; my $system_fail = 0; system( "ls . " ) == 0 || print "system failed before forking\n" my $pid = fork(); if( !defined( $pid ) ) { # bad, bad, error return 0; } elsif ($pid != 0) { # parent return $pid; } elsif ($pid == 0) { # $child system( "ls . " ) == 0 || print "system failed after forking(1)\n"; $> = $job->{'uid'}; $< = $job->{'uid'}; system( "ls . " ) == 0 || print "system failed after forking(2)\n"; setpgrp(0, $$); system( "ls . " ) == 0 || print "system failed after forking(3)\n"; ## doesn't exec, but continues on my $runner = Runner->new( $job ); $runner->run(); exit 1; } }
===
It seems that any system() call fails after setpgrp( 0, $$ ). Is setpgrp() an issue on solaris?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: system() call failure
by lestrrat (Deacon) on May 15, 2001 at 03:11 UTC | |
by no_slogan (Deacon) on May 15, 2001 at 04:09 UTC | |
by lestrrat (Deacon) on May 15, 2001 at 21:10 UTC | |
by lestrrat (Deacon) on May 16, 2001 at 23:02 UTC |