Skip to content

Commit

Permalink
Check for PHP every time around the loop #54
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Mar 12, 2023
1 parent aa854c0 commit 034468d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions php-loop.pl
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
our $dead = 0;
our $childpid = 0;

if (!-x $ARGV[0]) {
print STDERR "PHP command $ARGV[0] does not exist!\n";
exit(2);
}

$SIG{'TERM'} = sub {
$dead = 1;
if ($childpid) {
Expand All @@ -23,6 +18,10 @@
};

while(!$dead) {
if (!-x $ARGV[0]) {
print STDERR "PHP command $ARGV[0] does not exist!\n";
exit(2);
}
my $start = time();
$childpid = fork();
if ($childpid == 0) {
Expand Down

1 comment on commit 034468d

@MrPeteH
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THIS looks robust :)

Please sign in to comment.