Skip to content

Commit

Permalink
(#55) Test: fix ldd-apple output parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed May 26, 2024
1 parent a32d663 commit 31ca9db
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions macos/Test-Dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,16 @@ Get-ChildItem "$Package/*.dylib" | Sort-Object -Property Name | ForEach-Object {
Write-Output "Output from ldd-apple $($libraryPath):"
Write-Output $output

$libraryNames = $output | Where-Object { ([string]$_).Contains('dyld: loaded') } | ForEach-Object {
if (!($_ -match 'dyld: loaded: <.*?> (.*)')) {
$libraryNames = $output | Where-Object {
[string]$line = $_
$line.StartsWith('dyld[') -or $line.StartsWith('dyld: loaded:')
} | ForEach-Object {
if (!($_ -match 'dyld(?:: loaded|\[\d+\]): <.*?> (.*)')) {
throw "Failed to parse ldd-apple output: $_"
}

$filePath = $Matches[1]
if ($filePath -ne $libraryPath) {
if ($filePath -ne $libraryPath -and !$filePath.Contains('cpp.exec')) {
$filePath
}
} | Sort-Object
Expand Down

0 comments on commit 31ca9db

Please sign in to comment.