fix(telemetry): process referenced on non-nodejs runtime (#4007)

* process in cf worker

* lint
This commit is contained in:
KinfeMichael Tariku
2025-08-14 22:47:05 +03:00
committed by Bereket Engida
parent 3857c57c16
commit 8023a72c0d
2 changed files with 8 additions and 4 deletions

View File

@@ -1,7 +1,8 @@
// https://github.com/zkochan/packages/blob/main/which-pm-runs/index.js
export function detectPackageManager() {
const userAgent = process.env.npm_config_user_agent;
import { env } from "../../utils/env";
export function detectPackageManager() {
const userAgent = env.npm_config_user_agent;
if (!userAgent) {
return undefined;
}

View File

@@ -91,7 +91,10 @@ export async function detectSystemInfo() {
memory: os.totalmem(),
isWSL: await isWsl(),
isDocker: await isDocker(),
isTTY: process.stdout.isTTY,
isTTY:
typeof process !== "undefined" && (process as any).stdout
? (process as any).stdout.isTTY
: null,
};
} catch (e) {
return {
@@ -150,7 +153,7 @@ async function isDocker() {
async function isWsl() {
try {
if (getVendor() === "cloudflare") return false;
if (process.platform !== "linux") {
if (typeof process === "undefined" || process.platform !== "linux") {
return false;
}
const importRuntime = (m: string) =>