Skip to content

Commit

Permalink
resolve-system-dependencies: fix otool invocation
Browse files Browse the repository at this point in the history
We should always read all the output before calling `waitpid` as
otherwise the process might overfill the buffer and block.
  • Loading branch information
kirelagin committed Jun 16, 2016
1 parent 6a5f9c8 commit 22e6bfc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/resolve-system-dependencies.pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,19 @@ sub find_deps($) {
my $lib = shift;
my($chld_in, $chld_out, $chld_err);
my $pid = open3($chld_in, $chld_out, $chld_err, "@otool@", "-L", "-arch", "x86_64", $lib);
waitpid($pid, 0);
my $line = readline $chld_out;
if($? == 0 and $line !~ /not an object file/) {
if($line !~ /not an object file/) {
my @libs;
while(<$chld_out>) {
my $dep = (split /\s+/)[1];
push @libs, $dep unless $dep eq $lib or $dep =~ /\@rpath/;
}
@libs
waitpid($pid, 0);
if ($? == 0) {
@libs
} else {
()
}
} elsif (-l $lib) {
(realpath($lib))
} else {
Expand Down

0 comments on commit 22e6bfc

Please sign in to comment.