in reply to Re^3: Ulimit makes program hang
in thread Ulimit makes program hang

After insterting sleep before shelling out I get exactly same results.

I'm not a system programmer to analyse strace output...sorry.

I have tried fork and exec this way:
#!/usr/bin/perl -w my $x = $ARGV[0] + 1; print STDERR "$x\n"; if (!defined($child_pid = fork())) { die "cannot fork: $!"; } elsif ($child_pid) { waitpid($child_pid, 0); } else { exec "$0 $x"; }
This program never hangs -- always says cannot fork: Resource temporarily unavailable at ./fork_wait line 7.
But I must grab output of command so I can't use this solution.

Replies are listed 'Best First'.
Re^5: Ulimit makes program hang
by Bloodnok (Vicar) on Aug 13, 2008 at 16:50 UTC
    ...as I suspected, using the evidence of your OP and this posting, I think you've got enough to raise a perl bug against the backtick (``) operator - I think it should die with a similar fatal error.

    Section 16 of the Perl Cookbook should provide you with some background in order to progress further with capturing output from a command ...

    HTH ,

    A user level that continues to overstate my experience :-))