Codebase list libcapture-tiny-perl / 671cd7e
timeout if subprocesses don't start; note Changes David Golden 15 years ago
2 changed file(s) with 18 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
88
99 0.04
1010
11
11 Added:
12
13 - Can capture/tee even if STDIN, STDOUT or STDERR are closed prior to
14 capture/tee block
15
16 - Generally, added more error handling
17
18 Fixed:
19
20 - Will timeout instead of hang if subprocesses fail to start
21
1222 0.03 Fri Feb 20 13:03:08 EST 2009
1323
1424 Added:
139139 $stash->{pid}{$which} = $pid
140140 }
141141
142 sub _files_exist { -f $_ || return 0 for @_; return 1 }
143
142144 sub _wait_for_tees {
143145 my ($stash) = @_;
144 for my $file ( values %{$stash->{flag_files}} ) {
145 1 until -f $file; # XXX should add alarm and timeout
146 unlink $file
147 };
146 my $start = time;
147 my @files = values %{$stash->{flag_files}};
148 1 until _files_exist(@files) || (time - $start > 30);
149 die "Timed out waiting for subprocesses to start" if ! _files_exist(@files);
150 unlink $_ for @files;
148151 }
149152
150153 sub _kill_tees {