Changed die to Carp::confess()
David Golden
15 years ago
7 | 7 | use 5.006; |
8 | 8 | use strict; |
9 | 9 | use warnings; |
10 | use Carp (); | |
10 | 11 | use Exporter (); |
11 | 12 | use IO::Handle (); |
12 | 13 | use File::Spec (); |
49 | 50 | } |
50 | 51 | |
51 | 52 | sub _open { |
52 | open $_[0], $_[1] or die "Error from open(" . join(q{, }, @_) . "): $!"; | |
53 | open $_[0], $_[1] or Carp::confess "Error from open(" . join(q{, }, @_) . "): $!"; | |
53 | 54 | _debug( "# open " . join( ", " , map { defined $_ ? _name($_) : 'undef' } @_ ) . " as " . fileno( $_[0] ) . "\n" ); |
54 | 55 | } |
55 | 56 | |
56 | 57 | sub _close { |
57 | close $_[0] or die "Error from close(" . join(q{, }, @_) . "): $!"; | |
58 | close $_[0] or Carp::confess "Error from close(" . join(q{, }, @_) . "): $!"; | |
58 | 59 | _debug( "# closed " . ( defined $_[0] ? _name($_[0]) : 'undef' ) . "\n" ); |
59 | 60 | } |
60 | 61 | |
139 | 140 | my ($which, $stash) = @_; |
140 | 141 | my $pid = fork; |
141 | 142 | if ( not defined $pid ) { |
142 | die "Couldn't fork(): $!"; | |
143 | Carp::confess "Couldn't fork(): $!"; | |
143 | 144 | } |
144 | 145 | elsif ($pid == 0) { # child |
145 | 146 | _debug( "# in child process ...\n" ); |
160 | 161 | my $start = time; |
161 | 162 | my @files = values %{$stash->{flag_files}}; |
162 | 163 | 1 until _files_exist(@files) || (time - $start > 30); |
163 | die "Timed out waiting for subprocesses to start" if ! _files_exist(@files); | |
164 | Carp::confess "Timed out waiting for subprocesses to start" if ! _files_exist(@files); | |
164 | 165 | unlink $_ for @files; |
165 | 166 | } |
166 | 167 |