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

Astro info throws when xclip is not available #9039

Closed
1 task
fflaten opened this issue Nov 9, 2023 · 2 comments · Fixed by #9042
Closed
1 task

Astro info throws when xclip is not available #9039

fflaten opened this issue Nov 9, 2023 · 2 comments · Fixed by #9042
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@fflaten
Copy link
Contributor

fflaten commented Nov 9, 2023

Astro Info

> @fflaten/website@0.0.1 astro /workspaces/Website
> astro "info"

Astro                    v3.5.0
Node                     v18.16.0
System                   Linux (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             config-watcher
                         auto-import
                         @astrojs/sitemap
                         @astrojs/asides
                         astro-expressive-code
                         @astrojs/mdx
 error   Command failed: which xclip
  File:
    /workspaces/Website/node_modules/.pnpm/astro@3.5.0_@types+node@20.9.0_sass@1.69.5/node_modules/astro/dist/cli/info/index.js:38:20
  Code:
    37 |   } else {
    > 38 |     const output = execSync("which xclip", { encoding: "utf8" });
         |                    ^
      39 |     if (output[0] !== "/") {
      40 |       return;
      41 |     }
  Stacktrace:
Error: Command failed: which xclip
    at checkExecSyncError (node:child_process:885:11)
    at execSync (node:child_process:957:15)
    at copyToClipboard (file:///workspaces/Website/node_modules/.pnpm/astro@3.5.0_@types+node@20.9.0_sass@1.69.5/node_modules/astro/dist/cli/info/index.js:38:20)
    at printInfo (file:///workspaces/Website/node_modules/.pnpm/astro@3.5.0_@types+node@20.9.0_sass@1.69.5/node_modules/astro/dist/cli/info/index.js:28:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runCommand (file:///workspaces/Website/node_modules/.pnpm/astro@3.5.0_@types+node@20.9.0_sass@1.69.5/node_modules/astro/dist/cli/index.js:69:7)
    at async cli (file:///workspaces/Website/node_modules/.pnpm/astro@3.5.0_@types+node@20.9.0_sass@1.69.5/node_modules/astro/dist/cli/index.js:144:5)

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Error is thrown by execSync on non-zero exit code (xclip was not found). Missing try/catch here:

const output = execSync('which xclip', { encoding: 'utf8' });
if (output[0] !== '/') {
// Did not find a path for xclip, bail out!
return;
}

What's the expected result?

No error

Link to Minimal Reproducible Example

N/A

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Nov 9, 2023
@matthewp
Copy link
Contributor

matthewp commented Nov 9, 2023

Good catch! Do you want to submit a PR that wraps that in a try/catch and bails out in the catch? Would be much appreciated.

@matthewp matthewp added - P3: minor bug An edge case that only affects very specific usage (priority) and removed needs triage Issue needs to be triaged labels Nov 9, 2023
@fflaten
Copy link
Contributor Author

fflaten commented Nov 9, 2023

Thanks for the quick triage.
I might this weekend, but consider it up for grabs. I already have a backlog to tackle 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants