Codebase list libcapture-tiny-perl / 01098af
Changed die to Carp::confess() David Golden 15 years ago
1 changed file(s) with 5 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
77 use 5.006;
88 use strict;
99 use warnings;
10 use Carp ();
1011 use Exporter ();
1112 use IO::Handle ();
1213 use File::Spec ();
4950 }
5051
5152 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{, }, @_) . "): $!";
5354 _debug( "# open " . join( ", " , map { defined $_ ? _name($_) : 'undef' } @_ ) . " as " . fileno( $_[0] ) . "\n" );
5455 }
5556
5657 sub _close {
57 close $_[0] or die "Error from close(" . join(q{, }, @_) . "): $!";
58 close $_[0] or Carp::confess "Error from close(" . join(q{, }, @_) . "): $!";
5859 _debug( "# closed " . ( defined $_[0] ? _name($_[0]) : 'undef' ) . "\n" );
5960 }
6061
139140 my ($which, $stash) = @_;
140141 my $pid = fork;
141142 if ( not defined $pid ) {
142 die "Couldn't fork(): $!";
143 Carp::confess "Couldn't fork(): $!";
143144 }
144145 elsif ($pid == 0) { # child
145146 _debug( "# in child process ...\n" );
160161 my $start = time;
161162 my @files = values %{$stash->{flag_files}};
162163 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);
164165 unlink $_ for @files;
165166 }
166167