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 gitClone error logging and improve code quality #1366

Merged
merged 2 commits into from
Sep 9, 2024

Conversation

amuravski
Copy link
Contributor

Fixed error logging in the gitClone function. The previous implementation incorrectly assumed an error property on the spawnSync result object when a git clone operation failed.
Reduced code duplication in the gitClone function.

Successful spawnSync Result example
{
  status: 0,
  signal: null,
  output: [
    null,
    '',
    "Cloning into 'C:\\Users\\user\\AppData\\Local\\Temp\\vulnado.gitICn14i'...\n"
  ],
  pid: 7880,
  stdout: '',
  stderr: "Cloning into 'C:\\Users\\user\\AppData\\Local\\Temp\\vulnado.gitICn14i'...\n"
}
spawnSync Result with Error example
{
  status: 128,
  signal: null,
  output: [
    null,
    '',
    "Cloning into 'C:\\Users\\user\\AppData\\Local\\Temp\\vul nado.gitmRacDG'...\n" +
      "fatal: unable to access 'https://github.com/ScaleSec/vul nado.git/': URL rejected: Malformed input to a URL function\n"
  ],
  pid: 11532,
  stdout: '',
  stderr: "Cloning into 'C:\\Users\\user\\AppData\\Local\\Temp\\vul nado.gitmRacDG'...\n" +
    "fatal: unable to access 'https://github.com/ScaleSec/vul nado.git/': URL rejected: Malformed input to a URL function\n"
}

@prabhu
Copy link
Contributor

prabhu commented Sep 9, 2024

Thank you so much. Looks very neat!

@prabhu
Copy link
Contributor

prabhu commented Sep 9, 2024

Could you kindly sign the commit using the instructions in the below link?

https://github.com/CycloneDX/cdxgen/pull/1366/checks?check_run_id=29862579409

@prabhu
Copy link
Contributor

prabhu commented Sep 9, 2024

Also run pnpm lint && pnpm run gen-types

@amuravski
Copy link
Contributor Author

Linter warnings have been fixed and commits are finally signed :)

@prabhu prabhu merged commit 057205c into CycloneDX:master Sep 9, 2024
18 of 21 checks passed
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.

2 participants