Fix/patrol cli windows hang bundle#3094
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces several fixes for Windows compatibility in patrol_cli and patrol_mcp, including avoiding SIGTERM listeners on Windows to prevent SignalException crashes, draining the Gradle stderr stream to prevent hanging, and improving test path normalization. Feedback was provided regarding a potential runtime crash in test_bundler.dart if _projectRoot is a relative directory, suggesting the use of _projectRoot.absolute.path to ensure both paths are absolute.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| final fileAbs = _fs.path.isAbsolute(testFilePath) | ||
| ? _fs.path.normalize(testFilePath) | ||
| : _fs.path.normalize(_fs.path.join(_projectRoot.path, testFilePath)); |
There was a problem hiding this comment.
If _projectRoot is a relative directory (e.g., Directory('.')), _projectRoot.path will be relative. In this case, fileAbs will also be resolved as a relative path. Since testDirAbs is always absolute (using .absolute.path), passing a relative fileAbs and an absolute testDirAbs to _fs.path.relative will throw an ArgumentError at runtime (as the path package requires both paths to be either relative or absolute).
To prevent this potential runtime crash, use _projectRoot.absolute.path to ensure fileAbs is always resolved as an absolute path.
| final fileAbs = _fs.path.isAbsolute(testFilePath) | |
| ? _fs.path.normalize(testFilePath) | |
| : _fs.path.normalize(_fs.path.join(_projectRoot.path, testFilePath)); | |
| final fileAbs = _fs.path.isAbsolute(testFilePath) | |
| ? _fs.path.normalize(testFilePath) | |
| : _fs.path.normalize(_fs.path.join(_projectRoot.absolute.path, testFilePath)); |
05e789f to
b4ca14c
Compare
b4ca14c to
aee0c7b
Compare
Summary
Two Windows-specific fixes in patrol_cli's shared Android build path (affects
patrol test,patrol build,patrol develop, and MCPrun):gradlew :app:dependencies—detectOrchestratorVersionlistened only to stdout, so gradle's stderr filled the OS pipe buffer and the process blocked forever. Now drains stderr too. Fixes Can't launch test, stuck on gradlew dependencies #2565.test_bundle.dart—_normalizeTestPathused a literal prefix strip that broke when the test target used forward slashes (patrol develop/MCP) or a.\prefix (PowerShell tab-completion), leaking an absolute-path import. Now resolves the path withpath.relative. Fixes Generated test bundle is broken on Patrol 2.0 on Windows #1428.