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 5, 2025
1 parent e2b2326 commit a88c5a1
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 30 deletions.
1 change: 0 additions & 1 deletion compiler/tests-check-prim/main.4.14.output
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ jsoo_toplevel_init_reloc

From +unix.js:
caml_strerror
caml_sys_putenv
caml_unix_access
caml_unix_chdir
caml_unix_chmod
Expand Down
1 change: 0 additions & 1 deletion compiler/tests-check-prim/main.5.2.output
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ jsoo_toplevel_init_reloc

From +unix.js:
caml_strerror
caml_sys_putenv
caml_unix_access
caml_unix_chdir
caml_unix_chmod
Expand Down
1 change: 0 additions & 1 deletion compiler/tests-check-prim/main.5.3.output
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ jsoo_toplevel_init_reloc

From +unix.js:
caml_strerror
caml_sys_putenv
caml_unix_access
caml_unix_chdir
caml_unix_chmod
Expand Down
1 change: 0 additions & 1 deletion compiler/tests-check-prim/unix-Unix.4.14.output
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ jsoo_toplevel_init_compile
jsoo_toplevel_init_reloc

From +unix.js:
caml_sys_putenv
caml_unix_access
caml_unix_chdir
caml_unix_chmod
Expand Down
1 change: 0 additions & 1 deletion compiler/tests-check-prim/unix-Unix.5.2.output
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ jsoo_toplevel_init_reloc

From +unix.js:
caml_strerror
caml_sys_putenv
caml_unix_cleanup
caml_unix_filedescr_of_fd
caml_unix_findclose
Expand Down
1 change: 0 additions & 1 deletion compiler/tests-check-prim/unix-Unix.5.3.output
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ jsoo_toplevel_init_reloc

From +unix.js:
caml_strerror
caml_sys_putenv
caml_unix_cleanup
caml_unix_filedescr_of_fd
caml_unix_findclose
Expand Down
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 a88c5a1

Please sign in to comment.