Skip to content
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

fix: fix IPC error handling #5772

Merged
merged 2 commits into from
Mar 5, 2025
Merged

Conversation

CatalinSnyk
Copy link
Contributor

Pull Request Submission Checklist

  • Follows CONTRIBUTING guidelines
  • Includes detailed description of changes
  • Contains risk assessment (Low | Medium | High)
  • Highlights breaking API changes (if applicable)
  • Links to automated tests covering new functionality
  • Includes manual testing instructions (if necessary)
  • Updates relevant GitBook documentation (PR link: ___)
  • Includes product update to be announced in the next stable release notes

What does this PR do?

Previously, we would try to open the IPC error file even though the legacy cli run didn't result in any errors (this would not create the file as a result). The debug logs would log Failed to read error file: open <err-file-path>: no such file or directory, which might cause confusion for users.

Where should the reviewer start?

If the legacy CLI run resulted in an exit error with an exit code 0 or 1, we would not attempt to read from the error file; meaning if the exit code is greater or equal to 2, the error file should be checked against.

How should this be manually tested?

  • run a commad that invokes the Typescript CLI and would exit with the exit code 0 or 1 -> the debug logs should not contain the message listed above
  • run a commad that invokes the Typescript CLI and would exit with the exit code 0 or 1 -> the debug logs should contain a log about the error file being read

What's the product update that needs to be communicated to CLI users?

None

Other

@CatalinSnyk CatalinSnyk requested a review from a team as a code owner March 4, 2025 17:00
@@ -465,6 +465,10 @@ func (c *CLI) executeV1Default(proxyInfo *proxy.ProxyInfo, passThroughArgs []str
return nil
}

if exitErr, ok := err.(*exec.ExitError); ok && exitErr.ExitCode() < 2 {
Copy link
Contributor

Choose a reason for hiding this comment

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

question: is a test not necessary here?

Copy link
Collaborator

@PeterSchafer PeterSchafer Mar 4, 2025

Choose a reason for hiding this comment

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

Fair point! I wanted to have this fixed as I have mentioned this multiple times before, but covering it with a test is still reasonable and shouldn't take too much time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I guess I should make another PR and get that merged on main right?

chore: use writeFileSync instead of async one
Copy link
Contributor

github-actions bot commented Mar 5, 2025

Warnings
⚠️

Since the CLI is unifying on a standard and improved tooling, we're starting to migrate old-style imports and exports to ES6 ones.
A file you've modified is using either module.exports or require(). If you can, please update them to ES6 import syntax and export syntax.
Files found:

  • src/cli/ipc.ts
  • src/cli/main.ts
⚠️ There are multiple commits on your branch, please squash them locally before merging!

Generated by 🚫 dangerJS against 96520e2

@PeterSchafer PeterSchafer merged commit 7c515ad into release-candidate Mar 5, 2025
4 checks passed
@PeterSchafer PeterSchafer deleted the fix/fix-ipc-err-handling branch March 5, 2025 17:39
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