Tighten Windows process number guards

Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
Cursor AgentandJulius Marminge committed 2026-07-09 16:09:48 +00:00
1 parent f179a675e3
commit 048e0fb9ac
1 file changed
+6 -2
@@ -154,11 +154,15 @@ const decodeWindowsProcessRowsJson = Schema.decodeUnknownOption(WindowsProcessRo
const decodeWindowsProcessRowJson = Schema.decodeUnknownOption(WindowsProcessRowJson);
function positiveIntegerOption(value: number | undefined): Option.Option<number> {
return Number.isInteger(value) && value > 0 ? Option.some(value) : Option.none();
return typeof value === "number" && Number.isInteger(value) && value > 0
? Option.some(value)
: Option.none();
}
function nonNegativeIntegerOption(value: number | undefined): Option.Option<number> {
return Number.isInteger(value) && value >= 0 ? Option.some(value) : Option.none();
return typeof value === "number" && Number.isInteger(value) && value >= 0
? Option.some(value)
: Option.none();
}
export function parsePosixProcessRows(output: string): ReadonlyArray<ProcessRow> {