I'm trying to spawn off a shell process to download an image. It's in a loop as there are a few hundred of these (hence the need to do it in parrallel and not use LWP), but I've reduced to the code to the actual issue.
The problem is that the subprocess never returns. Can anyone spot the glaring flaw in my code?
print "here is ok\"; &spawnwebget("wget somesite.com/webcam.jpg;".'if [ $? -ne 0 ];'." then + cp ./images/broken.jpg webcam.jpg;fi"); print "never gets here\n"; sub spawnwebget { my ($url)=@_; #avoid zombies my $pid = fork; next if $pid; warn($!), next if not defined $pid; exec ($url); #never reaches here return; }
In reply to spawning exec fails to return by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |