summaryrefslogtreecommitdiff
path: root/runtime/js/30_os.js
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/js/30_os.js')
-rw-r--r--runtime/js/30_os.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/runtime/js/30_os.js b/runtime/js/30_os.js
index 23c3d8de6..0ce831775 100644
--- a/runtime/js/30_os.js
+++ b/runtime/js/30_os.js
@@ -21,7 +21,12 @@
}
function systemCpuInfo() {
- return core.jsonOpSync("op_system_cpu_info");
+ const { cores, speed } = core.jsonOpSync("op_system_cpu_info");
+ // Map nulls to undefined for compatibility
+ return {
+ cores: cores ?? undefined,
+ speed: speed ?? undefined,
+ };
}
// This is an internal only method used by the test harness to override the
@@ -44,7 +49,7 @@
return;
}
- core.jsonOpSync("op_exit", { code });
+ core.jsonOpSync("op_exit", code);
throw new Error("Code not reachable");
}
@@ -53,11 +58,11 @@
}
function getEnv(key) {
- return core.jsonOpSync("op_get_env", { key })[0];
+ return core.jsonOpSync("op_get_env", key) ?? undefined;
}
function deleteEnv(key) {
- core.jsonOpSync("op_delete_env", { key });
+ core.jsonOpSync("op_delete_env", key);
}
const env = {