Skip to content

Commit

Permalink
fix: temporarily disable telemetry on windows (#5899)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Choudhury <dannychoudhury@gmail.com>
  • Loading branch information
jtoar and dac09 authored Jul 12, 2022
1 parent 70b3806 commit 1ae8218
Showing 1 changed file with 11 additions and 2 deletions.
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'
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

0 comments on commit 1ae8218

Please sign in to comment.