Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 66481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:06:36+00:00 2026-05-10T19:06:36+00:00

I have been trying to use the Perl utility/module "prove" as a test harness

  • 0

I have been trying to use the Perl utility/module "prove" as a test harness for some unit tests. The unit tests are a little more "system" than "unit" as I need to fork off some background processes as part of the test, Using the following…

sub SpinupMonitor{    my $base_dir = shift;    my $config = shift;     my $pid = fork();    if($pid){       return $pid;    }else{       my $cmd = "$base_dir\/..\/bin\/monitor_real.pl -config $config -test";       close STDOUT;        exec ($cmd) or die "cannot exec test code [$cmd]\n";    } }  sub KillMonitor{     my $pid = shift;     print "Killing monitor [$pid]\n";    kill(1,$pid); } 

However for some reason when I have my .t file spin up some extra processes it causes the test harness to hang at the end of the first .t file after all the tests have finished, rather than going on to the next file, or exiting if there is only one.

At first I wondered if it might be because I was killing of my sub-processes and leaving them defunct. So I added..

$SIG{CHLD} = \&REAPER; sub REAPER {    my $pid = wait;    $SIG{CHLD} = \&REAPER; } 

To the code. But that doesn’t help. In fact on closed examination it turns out that my perl test file has exited and is now a defunct process and it is the prove wrapper script that has not reaped its child. In fact when I added a die() call at the end of my test script I got…

# Looks like your test died just after 7. 

So my script exited but for some reason the harness isn’t unraveling.

I did confirm that it is definitely my sub-processes that are upsetting it as when I disabled them while the tests failed the harness exited properly.

Is there anything I am doing wrong with the way I am starting up my processes that might upset the harness in some way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T19:06:37+00:00Added an answer on May 10, 2026 at 7:06 pm

    I’m assuming that all your kids have exited before you leave your test? Because otherwise, it may be hanging on to STDERR, which may confuse prove. If you could close STDERR, or at least redirect to a pipe in your parent process, that may be one issue you’re having.

    Besides that, I’d also point out that you don’t need to escape forward slashes, and if you’re not using shell metacharacters (spaces are not metacharacters to perl – think ‘*?{}()‘), you should be explicit and create a list:

    use File::Spec; my @cmd = File::Spec->catfile($basedir,                               File::Spec->updir(),                               qw(bin monitor_real.pl)                              ),           -config => $config,           -test   =>;  close STDOUT; close STDERR;  exec (@cmd) or die 'cannot exec test code [@cmd]\n'; 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 68k
  • Answers 68k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Handle this in your Global.asax's OnError event: protected void Application_Error(object… May 11, 2026 at 12:24 pm
  • added an answer It is difficult to say with certainty as there are… May 11, 2026 at 12:24 pm
  • added an answer The CSS selectors in the provided stylesheets are overriding the… May 11, 2026 at 12:24 pm

Related Questions

I have been trying to use the latest NAnt (0.86 Beta 1) for a
I am trying to use the following code, which I have not been able
There are quite a number of modules on CPAN relating to the creation and

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.