[Bioperl-l] Issues with new Bio::Tools::Run modules for Genemark and Glimmer

Mark Johnson johnsonm at gmail.com
Thu Mar 1 16:49:20 UTC 2007


On 2/28/07, Hilmar Lapp <hlapp at gmx.net> wrote:
>
>
> I'm not sure how the user would be able to take out the child hitting
> ctrl-c if you run it through system() (except if the parent
> terminates first - but maybe then terminating a run-away child is in
> good order).


Quoting the perlfunc docs on system:

 Since "SIGINT" and "SIGQUIT" are ignored during the execution
               of "system", if you expect your program to terminate on
receipt
               of these signals you will need to arrange to do so yourself
               based on the return value.

                   @args = ("command", "arg1", "arg2");
                   system(@args) == 0
                        or die "system @args failed: $?"

               You can check all the failure possibilities by inspecting $?
               like this:

                   if ($? == -1) {
                       print "failed to execute: $!\n";
                   }
                   elsif ($? & 127) {
                       printf "child died with signal %d, %s coredump\n",
                           ($? & 127),  ($? & 128) ? 'with' : 'without';
                   }
                   else {
                       printf "child exited with value %d\n", $? >> 8;
                   }

               or more portably by using the W*() calls of the POSIX exten‐
               sion; see perlport for more information.

               When the arguments get executed via the system shell, results
               and return codes will be subject to its quirks and capabili‐
               ties.  See "'STRING'" in perlop and "exec" for details.

So, during a call to system(), a CTRL-C (SIGINT) won't take out the parent,
but it will take out the child, unless the child has caught it and handled
it.  If you don't care why the child failed, just that it did, I suppose the
distinction is a subtle one.


> I haven't read the IPC::run POD in full detail but you will want to
> make sure that if the parent gets killed the child does get killed
> too, or otherwise you'll have a run-away process that novices will
> have trouble with understanding or terminating.


I'll double check.


> Other than that though IPC::run seems like a useful module, so
> incurring this as a dependency should be fine.
>



More information about the Bioperl-l mailing list