feat(windows): implement multi platform process kill#1875
Merged
brandonskiser merged 4 commits intoaws:mainfrom May 19, 2025
Merged
feat(windows): implement multi platform process kill#1875brandonskiser merged 4 commits intoaws:mainfrom
brandonskiser merged 4 commits intoaws:mainfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1875 +/- ##
=======================================
Coverage 16.75% 16.75%
=======================================
Files 213 213
Lines 20704 20704
Branches 871 871
=======================================
Hits 3468 3468
Misses 17236 17236 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
70dc97c to
2779ab1
Compare
brandonskiser
previously approved these changes
May 19, 2025
|
|
||
| // Helper to create a long-running process for testing | ||
| fn spawn_test_process() -> std::process::Child { | ||
| let mut command = Command::new("cmd"); |
Contributor
There was a problem hiding this comment.
What is this command doing? Would rather tests not do stuff like send network requests to localhost if we can rather do a sleep 10000 or something otherwise
Contributor
Author
There was a problem hiding this comment.
Good call, no need to make network calls. Changed to be a timeout instead
|
|
||
| use crate::platform::Env; | ||
|
|
||
| /// Fields for OS release information |
Contributor
There was a problem hiding this comment.
Can we include the reference to the Linux manpage still in this doc comment? https://www.man7.org/linux/man-pages/man5/os-release.5.html
brandonskiser
approved these changes
May 19, 2025
brandonskiser
pushed a commit
that referenced
this pull request
May 21, 2025
This was referenced May 21, 2025
hayemaxi
pushed a commit
to hayemaxi/amazon-q-developer-cli
that referenced
this pull request
May 22, 2025
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.
Summary
This PR enhances the Amazon Q CLI with cross-platform process termination capabilities and optimizes Windows performance through stack size adjustments. These improvements ensure consistent behavior across operating systems while addressing Windows-specific memory constraints.
Changes
• Added Windows-specific implementation for process termination
• Ensured consistent behavior between Windows, macOS, and Linux platforms
• Implemented proper error handling for process termination failures
• Increased thread stack size allocation for Windows environments
• Optimized memory management for Windows-specific constraints
Technical Details
Process Termination
• Implemented platform-specific code paths for process termination
• Used Windows API for Windows and POSIX signals for Unix-based systems
• Added proper error handling and logging for failed termination attempts
Stack Size Optimization
• Increased default thread stack size on Windows to prevent stack overflow errors
• Windows has different memory management characteristics compared to Unix-based systems, requiring larger stack allocations
• This change prevents crashes during deep recursion or when handling complex data structures
• The stack size increase is crucial for stable operation on Windows, particularly when processing large amounts of data or during intensive operations
Default Stack Size Differences
• Windows default stack size: 1MB for user threads (significantly smaller than Linux)
• Linux default stack size: 8MB for user threads
• This 8x difference is critical when running memory-intensive operations
• Windows' smaller default stack size can lead to stack overflow errors in scenarios that work fine on Linux
• Our increase aligns the Windows stack size more closely with Linux defaults, ensuring consistent behavior across platforms
• This adjustment is particularly important for recursive operations and deep call stacks that are common in our CLI operations
Testing
• Verified process termination works correctly on Windows systems
• Confirmed backward compatibility with existing Unix/Linux implementations