Skip to content

Commit

Permalink
Don't add Unix.putenv
Browse files Browse the repository at this point in the history
  • Loading branch information
vouillon committed Feb 4, 2025
1 parent e2b2326 commit a1c06ab
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 24 deletions.
16 changes: 0 additions & 16 deletions runtime/js/unix.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,6 @@ function caml_unix_startup() {}
//Alias: win_cleanup
function caml_unix_cleanup() {}

//Provides: caml_sys_putenv (const, const)
//Requires: caml_jsstring_of_string, jsoo_static_env
function caml_sys_putenv(name, value) {
var name = caml_jsstring_of_string(name);
var value = caml_jsstring_of_string(value);
delete jsoo_static_env[name];
//nodejs env
var process = globalThis.process;
if (process && process.env) {
process.env[name] = value;
return 0;
}
if (!globalThis.jsoo_env) globalThis.jsoo_env = {};
globalThis.jsoo_env[name] = value;
}

//Provides: caml_unix_filedescr_of_fd const
//Alias: win_handle_fd
function caml_unix_filedescr_of_fd(x) {
Expand Down
1 change: 0 additions & 1 deletion runtime/wasm/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@
argv: () => (isNode ? process.argv.slice(1) : ["a.out"]),
on_windows: () => on_windows,
getenv: (n) => (isNode ? process.env[n] : null),
putenv: (n, v) => process.env[n] = v,
system: (c) => {
var res = require("node:child_process").spawnSync(c, {
shell: true,
Expand Down
7 changes: 0 additions & 7 deletions runtime/wasm/unix.wat
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
(param i32) (param i32) (param i32) (param i32) (param i32) (param i32)
(result f64)))
(import "bindings" "utimes" (func $utimes (param anyref f64 f64)))
(import "bindings" "putenv" (func $putenv (param anyref anyref)))
(import "bindings" "stat" (func $stat (param anyref i32) (result (ref eq))))
(import "bindings" "lstat" (func $lstat (param anyref i32) (result (ref eq))))
(import "bindings" "fstat"
Expand Down Expand Up @@ -338,12 +337,6 @@
(call $caml_unix_error (pop externref) (ref.null eq))))
(ref.i31 (i32.const 0)))

(func (export "caml_sys_putenv")
(param $name (ref eq)) (param $value (ref eq))
(call $putenv
(call $unwrap (call $caml_jsstring_of_string (local.get $name)))
(call $unwrap (call $caml_jsstring_of_string (local.get $value)))))

(func (export "caml_alloc_stat")
(param $large i32)
(param $dev i32) (param $ino i32) (param $kind i32) (param $perm i32)
Expand Down

0 comments on commit a1c06ab

Please sign in to comment.