@volter/supercode-health 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/darwin.mjs +11 -5
- package/package.json +1 -1
package/lib/darwin.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// macOS readers. Every one runs unprivileged; each returns raw cumulative values and leaves rates to derive.mjs.
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
|
+
import { delimiter, isAbsolute, join } from 'node:path';
|
|
3
4
|
import { fileURLToPath } from 'node:url';
|
|
4
5
|
import { run, clockSeconds, topBytes } from './run.mjs';
|
|
5
6
|
|
|
@@ -48,21 +49,26 @@ export async function processes() {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
let python;
|
|
51
|
-
/** python3 that
|
|
52
|
+
/** python3 as the PATH finds it, never one that would raise the Command Line Tools install dialog (/usr/bin/python3 is
|
|
53
|
+
* a stub without them, so it counts only when `xcode-select -p` names a developer directory). */
|
|
52
54
|
async function pythonPath() {
|
|
53
55
|
if (python !== undefined) return python;
|
|
54
56
|
python = null;
|
|
55
|
-
for (const
|
|
56
|
-
if (
|
|
57
|
+
for (const folder of String(process.env.PATH ?? '').split(delimiter)) {
|
|
58
|
+
if (!folder || !isAbsolute(folder)) continue;
|
|
59
|
+
const candidate = join(folder, 'python3');
|
|
60
|
+
if (!existsSync(candidate)) continue;
|
|
61
|
+
if (candidate === '/usr/bin/python3' && !(await run('/usr/bin/xcode-select', ['-p'], { timeoutMs: 3000 })).ok) continue;
|
|
62
|
+
python = candidate;
|
|
63
|
+
break;
|
|
57
64
|
}
|
|
58
|
-
if (existsSync('/usr/bin/python3') && (await run('/usr/bin/xcode-select', ['-p'], { timeoutMs: 3000 })).ok) python = '/usr/bin/python3';
|
|
59
65
|
return python;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
/** Footprint and disk I/O per readable process (this user's; every user's as root). */
|
|
63
69
|
export async function rusage() {
|
|
64
70
|
const py = await pythonPath();
|
|
65
|
-
if (!py) throw Object.assign(new Error(
|
|
71
|
+
if (!py) throw Object.assign(new Error(`python3 is not on PATH (needed for libproc reads; searched ${process.env.PATH || 'an empty PATH'})`), { barrier: 'dependency' });
|
|
66
72
|
const r = await run(py, [RUSAGE], { timeoutMs: 10_000 });
|
|
67
73
|
if (!r.ok) throw new Error(r.error);
|
|
68
74
|
const map = new Map();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-health",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Optional machine pack: a cheap, deterministic probe of a machine's vitals that mails the machine's maintainer when a threshold is crossed. Each feature sits behind its own permission barrier.",
|
|
6
6
|
"license": "MIT",
|