Open
Conversation
7eaf5bb to
d5d1103
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #4836 by changing how “Compile Active File” runs compilation database commands, aiming to avoid VS Code terminal input truncation for long command lines by executing the compiler directly via a pseudoterminal rather than sending text to a shell terminal.
Changes:
- Refactors
CMakeDriver.runCompileCommand()to execute compile commands via avscode.Pseudoterminal+proc.execute()and removes cached file-compilation terminals. - Adds a new backend unit test suite validating compile command argument handling and very long command strings.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/drivers/cmakeDriver.ts | Switches file compilation to a pseudoterminal-backed proc.execute() flow to avoid PTY input truncation; removes terminal caching/disposal logic. |
| test/unit-tests/backend/compile-command.test.ts | Adds tests for argument population/splitting and long command-line preservation/display formatting. |
added 3 commits
March 27, 2026 10:50
906637c to
b1f64c6
Compare
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.
This change addresses item #4836
This changes visible behavior
This pull request refactors the handling of file compilation commands in the
CMakeDriverclass to address issues with long command lines being truncated in the VS Code terminal, especially for commands exceeding the PTY input buffer limit (4096 bytes). The solution replaces the previous approach of sending command strings viaterminal.sendText()with direct process execution using a pseudoterminal, ensuring all arguments are preserved regardless of length. Additionally, comprehensive unit tests have been added to verify correct argument handling and command execution.Key changes include:
Refactoring of file compilation terminal logic
_compileTermsmap and all logic related to caching and disposing of file compilation terminals, simplifying resource management and reducing potential for stale terminals. [1] [2] [3]runCompileCommand()method to:vscode.Pseudoterminal) that directly executes the compiler process with arguments as an array, bypassing the PTY buffer limitation and ensuring complete command execution for very long compile commands.Dependency and import cleanup
shlexfromcmakeDriver.tssince command splitting is now handled elsewhere.Unit tests for compile command handling
Added a new test suite (
test/unit-tests/backend/compile-command.test.ts) that:As you can see, long command lines exceeding 4096 can be executed without truncation: