Skip to content

Commit dd41903

Browse files
marcin-serwinMic92
authored andcommitted
Match last "got" in stderr to avoid false positives
Due to the changes introduced in #349 the hash regex matches the output of pnpm when downloading the https://www.npmjs.com/package/got library. This causes the tool to incorrectly update the hash to the "got" version. To fix this the loop now starts searching from the last line, since the nix hash mismatch message is usually printed last. Signed-off-by: Marcin Serwin <[email protected]>
1 parent af520c7 commit dd41903

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nix_update/update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def nix_prefetch(opts: Options, attr: str) -> str:
135135
# expected 'xxx' but got 'xxx'
136136
regex = re.compile(r".*got(:|\s)\s*'?([^']*)('|$)")
137137
got = ""
138-
for line in stderr.split("\n"):
138+
for line in reversed(stderr.split("\n")):
139139
if match := regex.fullmatch(line):
140140
got = match[2]
141141
break

0 commit comments

Comments
 (0)