[Git][ghc/ghc][wip/js-rename-getcwd] JS/base: handle `realpath` return argument (#23806)

Josh Meredith (@JoshMeredith) gitlab at gitlab.haskell.org
Wed Aug 30 05:57:52 UTC 2023



Josh Meredith pushed to branch wip/js-rename-getcwd at Glasgow Haskell Compiler / GHC


Commits:
a3e0a94a by Josh Meredith at 2023-08-30T15:57:39+10:00
JS/base: handle `realpath` return argument (#23806)

- - - - -


1 changed file:

- libraries/base/jsbits/base.js


Changes:

=====================================
libraries/base/jsbits/base.js
=====================================
@@ -297,12 +297,16 @@ function h$getcwd(buf, off, buf_size) {
     h$unsupported(-1);
 }
 
-function h$realpath(path,off) {
+function h$realpath(path,off,resolved,resolved_off) {
   TRACE_IO("realpath")
 #ifndef GHCJS_BROWSER
   if (h$isNode()) {
     try {
       var rp = h$encodeUtf8(fs.realpathSync(h$decodeUtf8z(path,off)));
+      if (resolved is not null) {
+        h$copyMutableByteArray(rp, 0, resolved, resolved_off, Math.min(resolved.len - resolved_off, rp.len));
+        RETURN_UBX_TUP2(resolved, resolved_off);
+      }
       RETURN_UBX_TUP2(rp, 0);
     } catch (e) {
       h$setErrno(e);



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a3e0a94a5315b09e6c640947e5b4b9c824081005

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a3e0a94a5315b09e6c640947e5b4b9c824081005
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230830/855e1ffa/attachment-0001.html>


More information about the ghc-commits mailing list