1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { arch, versions } from "ext:deno_node/_process/process.ts";
import { cpus, hostname, networkInterfaces } from "node:os";
import { primordials } from "ext:core/mod.js";
const {
Error,
StringPrototypeToUpperCase,
StringPrototypeCharAt,
StringPrototypeSlice,
Date,
DatePrototypeGetTime,
} = primordials;
function writeReport(_filename: string, _err: typeof Error) {
return "";
}
const todoUndefined = undefined;
function getReport(_err: typeof Error) {
const dumpEventTime = new Date();
return {
header: {
reportVersion: 3,
event: "JavaScript API",
trigger: "GetReport",
filename: report.filename, // assumption!
dumpEventTime,
dumpEventTimeStamp: DatePrototypeGetTime(dumpEventTime),
processId: Deno.pid, // I am not sure if it should be Deno.pid or Deno.ppid
threadId: 0,
cwd: Deno.cwd(),
commandLine: ["node"],
nodejsVersion: `v${versions.node}`,
glibcVersionRuntime: "2.38",
glibcVersionCompiler: "2.38",
wordSize: 64,
arch: arch(),
platform: Deno.build.os,
componentVersions: versions,
release: {
name: "node",
headersUrl:
"https://nodejs.org/download/release/v21.2.0/node-v21.2.0-headers.tar.gz",
sourceUrl:
"https://nodejs.org/download/release/v21.2.0/node-v21.2.0.tar.gz",
},
osName:
StringPrototypeToUpperCase(StringPrototypeCharAt(Deno.build.os, 0)) +
StringPrototypeSlice(Deno.build.os, 1),
osRelease: todoUndefined,
osVersion: todoUndefined,
osMachine: Deno.build.arch,
cpus: cpus(),
networkInterfaces: networkInterfaces(),
host: hostname(),
},
javascriptStack: todoUndefined,
javascriptHeap: todoUndefined,
nativeStack: todoUndefined,
resourceUsage: todoUndefined,
uvthreadResourceUsage: todoUndefined,
libuv: todoUndefined,
workers: [],
environmentVariables: todoUndefined,
userLimits: todoUndefined,
sharedObjects: todoUndefined,
};
}
// https://nodejs.org/api/process.html#processreport
export const report = {
compact: false,
directory: "",
filename: "",
getReport,
reportOnFatalError: false,
reportOnSignal: false,
reportOnUncaughtException: false,
signal: "SIGUSR2",
writeReport,
};
|