Testing msi: Add retries if necessary

Hoping this will fix the annoying problems on Windows Jenkins.
This commit is contained in:
Andrew Johnson
2017-05-04 14:48:18 -05:00
parent efe8d69f82
commit 05d3e640cd

View File

@@ -58,5 +58,19 @@ sub msi {
my ($args) = @_;
my $exe = ($^O eq 'MSWin32') || ($^O eq 'cygwin') ? '.exe' : '';
my $msi = "./msi-copy$exe";
return `$msi $args`;
my $result;
if ($args =~ m/-o / && $args !~ m/-D/) {
# An empty result is expected
$result = `$msi $args`;
}
else {
# Try up to 5 times, sometimes msi fails on Windows
my $count = 5;
do {
$result = `$msi $args`;
print "# result of '$msi $args' empty, retrying\n"
if $result eq '';
} while ($result eq '') && (--$count > 0);
}
return $result;
}