Skip to content

feat: add proper windows support for executeBash and remove mocks in tests. #934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 11, 2025

Conversation

Hweinstock
Copy link
Contributor

@Hweinstock Hweinstock commented Apr 9, 2025

Problem

The tests for executeBash currently mock the underlying process providing little confidence the flow works properly, as child processes can behave in unexpected ways on different OS.

After removing the mocks for executeBash the tests still pass on windows. I suspect this is because Git for Windows includes Git Bash which includes which and other unix utilities. However, this may not be the case on customer machines.

Solution

  • remove the mocks, and test the actual flow.
  • add proper windows support by using where instead since Node spawned processes default to command prompt, which supports where by default.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Hweinstock Hweinstock changed the title feat: add windows support to executeBash tool feat: avoid mocking in bash tool tests Apr 9, 2025
@Hweinstock Hweinstock marked this pull request as ready for review April 9, 2025 14:56
@Hweinstock Hweinstock requested a review from a team as a code owner April 9, 2025 14:56
@Hweinstock Hweinstock changed the title feat: avoid mocking in bash tool tests feat: add proper windows support for executeBash and remove mocks in tests. Apr 9, 2025
@@ -220,6 +220,7 @@ export class ExecuteBash {

let firstChunk = true
let firstStderrChunk = true
const writer = updates?.getWriter()
Copy link
Contributor

@kmile kmile Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this writer used? If it's used to communicate updates to the client then we might want to initialize the tool with a more comprehensive abstraction (I'm not saying tossing Features into it, but maybe something more explicit than an any stream?)

Copy link
Contributor Author

@Hweinstock Hweinstock Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it is used to pipe the stdout and stderr streams into the chat from the ChildProcess.

Yes, I agree an abstraction would be helpful. This is the equivalent of that on the VSC side, but this will likely have to be rewritten to properly interface with Flare's chat interface.

@Hweinstock Hweinstock merged commit 148062f into aws:main Apr 11, 2025
12 checks passed
@Hweinstock Hweinstock deleted the executeBash/windows branch April 11, 2025 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants