Skip to content

Commit 5eab800

Browse files
committed
Fixed issue in patching config file to update repo. If the repo was on the
last line and the file had no new line at the end, the repo would become `psij-pytho`.
1 parent 079ec6a commit 5eab800

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/ci_runner.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ def patch_file(file_name: str) -> None:
175175
# when invoking a subprocess, bash stores the location where
176176
# it's supposed to continue parsing from, so it's a good idea
177177
# to to not move things around
178-
line = line.replace(OLD_REPO, NEW_REPO)[:-1] + ' \n'
178+
if line[-1] == '\n':
179+
# It could be that this is the last line and missing a new line
180+
line = line[:-1]
181+
line = line.replace(OLD_REPO, NEW_REPO) + ' \n'
179182
outf.write(line)
180183
os.chmod(file_name + '._new_', os.stat(file_name).st_mode)
181184
os.rename(file_name + '._new_', file_name)

0 commit comments

Comments
 (0)