+1
-6
@@ -108,3 +108,2 @@ #include <assert.h> | ||
| char exec_path[4096]; | ||
| err = uv_exepath(exec_path, &len); | ||
@@ -153,3 +152,2 @@ if (err < 0) { | ||
| char cwd[4096]; | ||
| err = uv_cwd(cwd, &len); | ||
@@ -203,3 +201,2 @@ if (err < 0) { | ||
| char tmpdir[4096]; | ||
| err = uv_os_tmpdir(tmpdir, &len); | ||
@@ -226,3 +223,2 @@ if (err < 0) { | ||
| char homedir[4096]; | ||
| err = uv_os_homedir(homedir, &len); | ||
@@ -249,3 +245,2 @@ if (err < 0) { | ||
| char hostname[UV_MAXHOSTNAMESIZE]; | ||
| err = uv_os_gethostname(hostname, &len); | ||
@@ -1351,3 +1346,3 @@ if (err < 0) { | ||
| V("getEnv", bare_os_get_env) | ||
| V("hasEnv", bare_os_get_env) | ||
| V("hasEnv", bare_os_has_env) | ||
| V("setEnv", bare_os_set_env) | ||
@@ -1354,0 +1349,0 @@ V("unsetEnv", bare_os_unset_env) |
+1
-1
@@ -30,3 +30,3 @@ import constants from './lib/constants' | ||
| export function chdir(dir: string): string | ||
| export function chdir(dir: string): void | ||
@@ -33,0 +33,0 @@ export function tmpdir(): string |
+151
-30
@@ -20,17 +20,64 @@ const binding = require('./binding') | ||
| exports.type = binding.type | ||
| exports.version = binding.version | ||
| exports.release = binding.release | ||
| exports.machine = binding.machine | ||
| exports.execPath = binding.execPath | ||
| exports.pid = binding.pid | ||
| exports.ppid = binding.ppid | ||
| exports.cwd = binding.cwd | ||
| exports.chdir = binding.chdir | ||
| exports.tmpdir = binding.tmpdir | ||
| exports.homedir = binding.homedir | ||
| exports.hostname = binding.hostname | ||
| exports.userInfo = binding.userInfo | ||
| exports.groupInfo = binding.groupInfo | ||
| exports.type = function type() { | ||
| return binding.type() | ||
| } | ||
| exports.version = function version() { | ||
| return binding.version() | ||
| } | ||
| exports.release = function release() { | ||
| return binding.release() | ||
| } | ||
| exports.machine = function machine() { | ||
| return binding.machine() | ||
| } | ||
| exports.execPath = function execPath() { | ||
| return binding.execPath() | ||
| } | ||
| exports.pid = function pid() { | ||
| return binding.pid() | ||
| } | ||
| exports.ppid = function ppid() { | ||
| return binding.ppid() | ||
| } | ||
| exports.cwd = function cwd() { | ||
| return binding.cwd() | ||
| } | ||
| exports.chdir = function chdir(dir) { | ||
| validateString(dir, 'Directory') | ||
| binding.chdir(dir) | ||
| } | ||
| exports.tmpdir = function tmpdir() { | ||
| return binding.tmpdir() | ||
| } | ||
| exports.homedir = function homedir() { | ||
| return binding.homedir() | ||
| } | ||
| exports.hostname = function hostname() { | ||
| return binding.hostname() | ||
| } | ||
| exports.userInfo = function userInfo(uid) { | ||
| if (uid !== undefined) validateInteger(uid, 'User ID') | ||
| return binding.userInfo(uid) | ||
| } | ||
| exports.groupInfo = function groupInfo(gid) { | ||
| if (gid !== undefined) validateInteger(gid, 'Group ID') | ||
| return binding.groupInfo(gid) | ||
| } | ||
| exports.networkInterfaces = function networkInterfaces() { | ||
@@ -50,2 +97,4 @@ const result = {} | ||
| exports.kill = function kill(pid, signal = constants.signals.SIGTERM) { | ||
| validateInteger(pid, 'Process ID') | ||
| if (typeof signal === 'string') { | ||
@@ -57,2 +106,4 @@ if (signal in constants.signals === false) { | ||
| signal = constants.signals[signal] | ||
| } else { | ||
| validateInteger(signal, 'Signal') | ||
| } | ||
@@ -67,3 +118,5 @@ | ||
| exports.availableParallelism = binding.availableParallelism | ||
| exports.availableParallelism = function availableParallelism() { | ||
| return binding.availableParallelism() | ||
| } | ||
@@ -96,14 +149,42 @@ exports.cpuUsage = function cpuUsage(previous) { | ||
| exports.resourceUsage = binding.resourceUsage | ||
| exports.memoryUsage = binding.memoryUsage | ||
| exports.freemem = binding.freemem | ||
| exports.totalmem = binding.totalmem | ||
| exports.availableMemory = binding.availableMemory | ||
| exports.constrainedMemory = binding.constrainedMemory | ||
| exports.uptime = binding.uptime | ||
| exports.loadavg = binding.loadavg | ||
| exports.cpus = binding.cpus | ||
| exports.resourceUsage = function resourceUsage() { | ||
| return binding.resourceUsage() | ||
| } | ||
| exports.getProcessTitle = binding.getProcessTitle | ||
| exports.memoryUsage = function memoryUsage() { | ||
| return binding.memoryUsage() | ||
| } | ||
| exports.freemem = function freemem() { | ||
| return binding.freemem() | ||
| } | ||
| exports.totalmem = function totalmem() { | ||
| return binding.totalmem() | ||
| } | ||
| exports.availableMemory = function availableMemory() { | ||
| return binding.availableMemory() | ||
| } | ||
| exports.constrainedMemory = function constrainedMemory() { | ||
| return binding.constrainedMemory() | ||
| } | ||
| exports.uptime = function uptime() { | ||
| return binding.uptime() | ||
| } | ||
| exports.loadavg = function loadavg() { | ||
| return binding.loadavg() | ||
| } | ||
| exports.cpus = function cpus() { | ||
| return binding.cpus() | ||
| } | ||
| exports.getProcessTitle = function getProcessTitle() { | ||
| return binding.getProcessTitle() | ||
| } | ||
| exports.setProcessTitle = function setProcessTitle(title) { | ||
@@ -120,2 +201,4 @@ if (typeof title !== 'string') title = title.toString() | ||
| exports.getPriority = function getPriority(pid = 0) { | ||
| validateInteger(pid, 'Process ID') | ||
| return binding.getPriority(pid) | ||
@@ -130,9 +213,47 @@ } | ||
| validateInteger(pid, 'Process ID') | ||
| validateInteger(priority, 'Priority') | ||
| binding.setPriority(pid, priority) | ||
| } | ||
| exports.getEnvKeys = binding.getEnvKeys | ||
| exports.getEnv = binding.getEnv | ||
| exports.hasEnv = binding.hasEnv | ||
| exports.setEnv = binding.setEnv | ||
| exports.unsetEnv = binding.unsetEnv | ||
| exports.getEnvKeys = function getEnvKeys() { | ||
| return binding.getEnvKeys() | ||
| } | ||
| exports.getEnv = function getEnv(name) { | ||
| validateString(name, 'Name') | ||
| return binding.getEnv(name) | ||
| } | ||
| exports.hasEnv = function hasEnv(name) { | ||
| validateString(name, 'Name') | ||
| return binding.hasEnv(name) | ||
| } | ||
| exports.setEnv = function setEnv(name, value) { | ||
| validateString(name, 'Name') | ||
| validateString(value, 'Value') | ||
| binding.setEnv(name, value) | ||
| } | ||
| exports.unsetEnv = function unsetEnv(name) { | ||
| validateString(name, 'Name') | ||
| binding.unsetEnv(name) | ||
| } | ||
| function validateString(value, name) { | ||
| if (typeof value !== 'string') { | ||
| throw new TypeError(`${name} must be a string. Received type ${typeof value} (${value})`) | ||
| } | ||
| } | ||
| function validateInteger(value, name) { | ||
| if (!Number.isInteger(value)) { | ||
| throw new TypeError(`${name} must be an integer. Received type ${typeof value} (${value})`) | ||
| } | ||
| } |
+1
-1
| { | ||
| "name": "bare-os", | ||
| "version": "3.9.2", | ||
| "version": "3.9.3", | ||
| "description": "Operating system utilities for Bare", | ||
@@ -5,0 +5,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
927234
0.64%323
35.15%