Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WFCORE-6597] Fix package availability detection in ps1 script #5759

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,9 @@ Function Get-Java-Opts {
}

Function SetPackageAvailable($packageName) {
$PACKAGE_AVAILABLE = $true
# java -version actually writes what we all read in our terminals to stderr, not stdout!
# So we redirect it to stdout with 2>&1 before piping to Out-String and Select-String
& $JAVA "--add-opens=$packageName=ALL-UNNAMED" -version 2>&1 | Out-String -Stream | Select-String 'WARNING' -SimpleMatch -Quiet >$null 2>&1
if ($LastExitCode -eq 0){
$PACKAGE_AVAILABLE = $false
}
$PACKAGE_AVAILABLE = !(& $JAVA "--add-opens=$packageName=ALL-UNNAMED" -version 2>&1 | Out-String -Stream | Select-String 'WARNING' -SimpleMatch -Quiet)
return $PACKAGE_AVAILABLE
}

Expand Down