[vox-tech] signal in perl not being caught

Peter Jay Salzman vox-tech@lists.lugod.org
Tue, 14 May 2002 10:02:39 -0700


i'd like to catch a control-c to stop this wrapper program to a grinding
halt.   for some reason it's not catching control-c.

what's wrong with this code snippet?

pete


#!/usr/bin/perl -w
use strict;
use diagnostics;

# Basic Variables
my $T = 4.0;
my $runs = 25;

# Other Variables, tests and misc
my $result_file = "results";
my $program =  "./ising2-pbc";
my ($temp, $i);
if (-r $result_file) { unlink($result_file); };
if (! -r $program  ) { system("make");       };
$SIG{INT} = sub { die("caught sigint.  aborting."); };

for ($i=0; $i<$runs; ++$i)
{
   print("Run $i/$runs, T: $T\n");
   system("$program $T > $result_file");
}

(snip)