feat: remove "cmd.exe" requirement for content-hashing - #171233
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
matanlurey
left a comment
There was a problem hiding this comment.
LGTM. This code is tested thoroughly
Removing cmd.exe means content_aware_hash.ps1 runs on other platforms as well. hash | command | host -|-|- 728dc653e5efeb64175acce4bd2d7090781df70a | content_aware_hash.sh | mac 728dc653e5efeb64175acce4bd2d7090781df70a | content_aware_hash.ps1 | powershell 5.1 windows 11 728dc653e5efeb64175acce4bd2d7090781df70a | content_aware_hash.ps1 | powershell 7.5.1 macos
| #. the contents of hash.txt | ||
| (git -C "$flutterRoot" ls-tree --format "%(objectname) %(path)" HEAD DEPS engine bin/internal/release-candidate-branch.version | Out-String) -replace "`r`n", "`n" | Out-File -NoNewline -Encoding ascii hash.txt | ||
| git hash-object hash.txt | ||
| Remove-Item hash.txt |
There was a problem hiding this comment.
@jtmcdole only hash.txt lead to problem when run command (also when Debug with VSCode)
C:\Windows\System32>C:\Development\fvm\versions\master\bin\flutter.bat --version
Out-File: C:\Development\fvm\versions\master\bin\internal\content_aware_hash.ps1:39
Line |
39 | … -replace "`r`n", "`n" | Out-File -NoNewline -Encoding ascii hash.txt
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Access to the path 'C:\Windows\System32\hash.txt' is denied.
Error: Unable to determine engine version...
Because working directory is C:\Windows\System32 so required Administrator on Windows to Out-File C:\Windows\System32\hash.txt
Could you add $flutterRoot before hash.txt or something not required Administrator permission?
There was a problem hiding this comment.
Good find - and yes, we can do that. Can you open a bug and reference this comment?
Removing cmd.exe means content_aware_hash.ps1 runs on other platforms as well. hash | command | host -|-|- 728dc653e5efeb64175acce4bd2d7090781df70a | content_aware_hash.sh | mac 728dc653e5efeb64175acce4bd2d7090781df70a | content_aware_hash.ps1 | powershell 5.1 windows 11 728dc653e5efeb64175acce4bd2d7090781df70a | content_aware_hash.ps1 | powershell 7.5.1 macos
Removing cmd.exe means content_aware_hash.ps1 runs on other platforms as well.