Fix/export make path injection#618
Merged
Merged
Conversation
On first install the make directory doesn't exist when the early Add-TuyaPathEntryIfMissing check runs, so make is never added to PATH. tos.py prepare then downloads make but a Python subprocess cannot modify its parent PowerShell's PATH. Re-check after prepare so make is available for subsequent build commands.
- Move PATH injection into Invoke-TuyaExportFinalize (right after prepare) instead of at call sites — covers first-install, re-source, and any future callers; also survives prepare throwing a terminating error at the call-site level (findings #3, #5/altitude) - Check make.exe -PathType Leaf instead of the containing directory, so a partial/failed download that created the dir but not the binary does not inject a broken path (findings #1, #2) - Remove the pre-prepare and post-finalize PATH checks from the main try-block; Invoke-TuyaExportFinalize now owns this concern - Fix Add-TuyaPathEntryIfMissing to use [System.IO.Path]::PathSeparator instead of hardcoded ';', avoiding broken deduplication on PowerShell Core / Linux (finding #7) - export.bat: guard PATH add on make.exe existence instead of directory, consistent with the ps1 fix (finding #4) - cli_prepare.py: call prepend_windows_make_to_path() in both success paths of ensure_windows_make so the function is no longer dead code and make is in PATH for any Python subprocesses tos.py spawns (finding #6)
yingtao450
approved these changes
Jun 17, 2026
Contributor
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
…insensitive handling - export.ps1: __tuyaTeardown now splits/joins PATH using [System.IO.Path]::PathSeparator, matching Add-TuyaPathEntryIfMissing so the add/remove sides stay consistent. - cli_prepare.py: prepend_windows_make_to_path compares entries with os.path.normcase to avoid duplicate PATH entries on case-insensitive filesystems, aligning with PowerShell's -ieq.
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.
PR 描述/PR description
[在此详细描述 PR 的内容]/[Describe the PR content in detail here]
代码质量/Code Quality:
在本次拉取请求中,我已考虑以下事项 As part of this pull request, I've considered the following: