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

Skip anonymous data usage question when running in a non-tty mode #79

Closed
dgonzalez opened this issue Nov 19, 2018 · 6 comments
Closed
Assignees

Comments

@dgonzalez
Copy link

Expected Behavior

Question for anonymous usage statistics should be skippable with a flag or detecting that there is no tty attached (to facilitate docker usage).

Current Behavior

When you run:

 clinic doctor -- node index.js

there is a question prompted that requires interaction:

May Clinic report anonymous usage statistics to improve the tool over time? (Y/n)

Environment

  • Clinic version: 2.0.0
  • Doctor version: 3.6.0
@dgonzalez dgonzalez changed the title Skip anonymous data question when running in a non-tty mode Skip anonymous data usage question when running in a non-tty mode Nov 19, 2018
@mcollina
Copy link
Contributor

@goto-bus-stop can you have a look later this week?

Best way to do this is detecting if process.stdin.tty is false?

@goto-bus-stop
Copy link
Contributor

Ah, i kinda assumed this was handled inside insight . Can prob look into it tomorrow already

@dgonzalez
Copy link
Author

Actually wait. From Docker does nor prompt the question, only if it is run from a TTY so yes, works as expected. Excellent work.

@gerkenv
Copy link
Contributor

gerkenv commented Aug 24, 2022

If you run it from podman (docker alternative).

  1. if you call it from CMD step in the dockerfile.
  2. When you run container question most-probably appears and container exits with 0 code.
CMD clinic flame -- node index.js

A workaround is to use environment variable NO_INSIGHT with any value.
In this case profiling and server start as expected.

CMD NO_INSIGHT=true clinic flame -- node index.js

According to these lines:

  • node-clinic/bin.js

    Lines 273 to 277 in eaa709b

    if (insight.optOut === undefined) {
    return promisify(insight.askPermission).call(
    insight,
    'May Clinic.js report anonymous usage statistics to improve the tool over time?'
    )
  • node-clinic/bin.js

    Lines 35 to 38 in eaa709b

    if ('NO_INSIGHT' in process.env) {
    Object.defineProperty(insight, 'optOut', {
    get: () => true
    })

@RafaelGSS
Copy link
Contributor

@gerkenv would you like to include it in the README? That's useful information.

@gerkenv
Copy link
Contributor

gerkenv commented Aug 25, 2022

I hope it is enough #366

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

No branches or pull requests

5 participants