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: temporarily disable telemetry on windows #5899

Merged
merged 4 commits into from
Jul 12, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions packages/telemetry/src/telemetry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { spawn } from 'child_process'
import os from 'node:os'
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd be careful these - I'm not sure why... but I've found there are some cases where it throws errors (on Windows... if I remember correctly) - and other places the same imports didn't.

import path from 'path'

import { getPaths } from '@redwoodjs/internal'
Expand Down Expand Up @@ -43,8 +44,14 @@ export const timedTelemetry = async (
return result
}

// Returns 'Windows_NT' on Windows.
// See https://nodejs.org/docs/latest-v12.x/api/os.html#os_os_type.
const isWindows = os.type() === 'Windows_NT'

export const errorTelemetry = async (argv: Array<string>, error: any) => {
if (process.env.REDWOOD_DISABLE_TELEMETRY) {
// FIXME: on Windows, cmd opens and closes a few times.
// See https://github.com/redwoodjs/redwood/issues/5728.
if (isWindows || process.env.REDWOOD_DISABLE_TELEMETRY) {
return
}

Expand All @@ -53,7 +60,9 @@ export const errorTelemetry = async (argv: Array<string>, error: any) => {

// used as yargs middleware when any command is invoked
export const telemetryMiddleware = async () => {
if (process.env.REDWOOD_DISABLE_TELEMETRY) {
// FIXME: on Windows, cmd opens and closes a few times.
// See https://github.com/redwoodjs/redwood/issues/5728.
if (isWindows || process.env.REDWOOD_DISABLE_TELEMETRY) {
return
}

Expand Down