Logo
  • Home
  • About
  • Services
  • Blogs
  • Career
  • Contact
Logo

The UK's #1 Software Development Company. PodTech IO builds custom software solutions for businesses. Call today for a free consultation

  • Address

    4th Floor, 4 Tabernacle Street London EC2A 4LU
  • Email

    info@podtech.com
  • Contact

    +44 (0) 20 8720 6583

Perl – Fork and Kill a System Process on Timeout

  • Home
  • Perl – Fork and Kill a System Process on Timeout
  • By podtech
  • In Perl

Perl – Fork and Kill a System Process on Timeout

[perl]

$pid = open(PIPE, “$command |”) or die $!;
eval {
local $SIG{ALRM} = sub { die “TIMEOUT” };
alarm($timeout);
while (<PIPE>) {
$data = $_;
};
close(PIPE);
alarm(0);
};
if ($@) {
die $@ unless $@ =~ /TIMEOUT/;
kill 15, $pid;
close(PIPE);
$? ||= 9;
} else {
## Exit status from the child
my $child_exit = $? >> 8;
if ($child_exit != 0) {
# Bad Status
} else {
# Clean Exit
}
}
[/perl]

ForkFork and Kill a System ProcessKill a System Process on TimeoutPerlSystem ProcessSystem Process on TimeoutTimeout
Removing the AVG secure search bar!!
Extract CREATES from SQL dump

Recent Posts

  • DevOps as a Software Development Methodology
  • How Does Spiral Software Development Methodology Work?
  • Waterfall Software Development Methodology And When To Use It
  • What Exactly Is Lean Software Development Methodology?
  • What is Kanban and How Does It Work?

PodTech IO

The UK's #1 Software Development Company. PodTech IO builds custom software solutions for businesses. Call today for a free consultation

Company

  • About
  • Services
  • Contact
  • Blogs
  • Career

Terms

  • Terms & Conditions
  • Privacy Policy

Contact Us

  • ADDRESS

    Headquarter: Tabernacle Street London India: Vi john Tower, Gurgaon, Haryana
  • EMAIL

    info@podtech.com
  • CONTACT

    +44 (0) 20 8720 6583

Copyright ©2023 PodTech IO. All Rights Reserved

Logo