Repository navigation
Windows: fix pp_ctl.exe check when more than one in path - #222
Merged
Merged
Conversation
esabol
requested changes
Nov 16, 2026
| } | ||
| if ($^O =~ /Win32/) { | ||
| my $fullpath = qx{where $pg_ctl}; | ||
| $fullpath =~ s/[\r\n]+?.+//; # we only want the first result |
Collaborator
There was a problem hiding this comment.
The ? after the + seems odd and quasi-incorrect.
I suggest $fullpath =~ s/\r?\n.*//s; instead and then you can remove the chomp on the next line as it will have nothing to do. (Note: The /s modifier makes . match newlines as well, ensuring it wipes out all subsequent lines in one go.)
Before this line, I would also add:
$fullpath = '' if !defined $fullpath;
in the unlikely event the external command fails to spawn or run (for example, if the shell itself fails to launch or encounters a fatal system-level error).
Contributor
Author
There was a problem hiding this comment.
Done.
The +? is a lazy quantifier but was unnecessary here in any case.
shawnlaffan
force-pushed
the
windows_where_call
branch
from
November 16, 2026 21:05
866dd9b to
fbcdea8
Compare
esabol
approved these changes
Nov 17, 2026
esabol
left a comment
Collaborator
There was a problem hiding this comment.
OK, looks good. Thank you! Merging...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
wherecall on Windows will return a multi-line string if more than one matching file is found in the path.This will result in invalid calls in
t/dbdpg_test_setup.pl, e.g.qx{$pgctlcom}might expand to
This then triggers the
Found non-space whitespace in command stringwarning.The
whereutility seems not to have an option to only return the first found so this PR simply strips everything from the first newline and/or carriage return characters.