disable Devel::Cover before exec-ing external tools to avoid massive slowdowns

This commit is contained in:
Johannes 'josch' Schauer 2020-01-08 15:40:42 +01:00
parent 4fed488c35
commit 6d3a824b45
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -612,6 +612,7 @@ sub run_progress {
if (defined $chdir) { if (defined $chdir) {
chdir $chdir or error "failed chdir() to $chdir: $!"; chdir $chdir or error "failed chdir() to $chdir: $!";
} }
eval 'Devel::Cover::set_coverage("none")' if $is_covering;
exec { $execargs[0] } @execargs or error 'cannot exec() ' . (join ' ', @execargs); exec { $execargs[0] } @execargs or error 'cannot exec() ' . (join ' ', @execargs);
} }
close $wfh; close $wfh;
@ -1494,12 +1495,14 @@ sub setup {
if ($pid1 == 0) { if ($pid1 == 0) {
open(STDOUT, '>&', $wfh) or error "cannot open STDOUT: $!"; open(STDOUT, '>&', $wfh) or error "cannot open STDOUT: $!";
debug("running dpkg-deb --fsys-tarfile $options->{root}/$deb"); debug("running dpkg-deb --fsys-tarfile $options->{root}/$deb");
eval 'Devel::Cover::set_coverage("none")' if $is_covering;
exec 'dpkg-deb', '--fsys-tarfile', "$options->{root}/$deb"; exec 'dpkg-deb', '--fsys-tarfile', "$options->{root}/$deb";
} }
my $pid2 = fork() // error "fork() failed: $!"; my $pid2 = fork() // error "fork() failed: $!";
if ($pid2 == 0) { if ($pid2 == 0) {
open(STDIN, '<&', $rfh) or error "cannot open STDIN: $!"; open(STDIN, '<&', $rfh) or error "cannot open STDIN: $!";
debug("running tar -C $options->{root} --keep-directory-symlink --extract --file -"); debug("running tar -C $options->{root} --keep-directory-symlink --extract --file -");
eval 'Devel::Cover::set_coverage("none")' if $is_covering;
exec 'tar', '-C', $options->{root}, '--keep-directory-symlink', '--extract', '--file', '-'; exec 'tar', '-C', $options->{root}, '--keep-directory-symlink', '--extract', '--file', '-';
} }
waitpid($pid1, 0); waitpid($pid1, 0);
@ -3373,6 +3376,7 @@ sub main() {
open(STDOUT, '>', $options->{target}) or error "cannot open $options->{target} for writing: $!"; open(STDOUT, '>', $options->{target}) or error "cannot open $options->{target} for writing: $!";
} }
open(STDIN, '<&', $rfh) or error "cannot open file handle for reading: $!"; open(STDIN, '<&', $rfh) or error "cannot open file handle for reading: $!";
eval 'Devel::Cover::set_coverage("none")' if $is_covering;
exec { $argv[0] } @argv or error ("cannot exec " . (join " ", @argv) . ": $!"); exec { $argv[0] } @argv or error ("cannot exec " . (join " ", @argv) . ": $!");
} }
POSIX::sigprocmask(SIG_UNBLOCK, $sigset) or error "Can't unblock signals: $!"; POSIX::sigprocmask(SIG_UNBLOCK, $sigset) or error "Can't unblock signals: $!";