[Git][ghc/ghc][wip/js-staging] Append program name in top-level exception handler

Sylvain Henry (@hsyl20) gitlab at gitlab.haskell.org
Tue Aug 23 21:34:46 UTC 2022



Sylvain Henry pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC


Commits:
f87da962 by Sylvain Henry at 2022-08-23T23:37:32+02:00
Append program name in top-level exception handler

- - - - -


1 changed file:

- js/environment.js.pp


Changes:

=====================================
js/environment.js.pp
=====================================
@@ -266,9 +266,15 @@ function h$errorMsg(pat) {
     str = str.replace(/%s/, arguments[i]);
   }
 #ifndef GHCJS_BROWSER
+  // basename that only works on Linux for now...
+  function basename(path) {
+   return path.split('/').reverse()[0];
+  }
   if(h$isGHCJSi) {
     // ignore message
   } else if(h$isNode) {
+    // append program name
+    str = basename(process.argv[1]) + ": " + str;
     process.stderr.write(str);
   } else if (h$isJsShell && typeof printErr !== 'undefined') {
     if(str.length) printErr(stripTrailingNewline(str));



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f87da962482797e2a7c902e4fae7348c5914c0a3
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/20220823/dea36c38/attachment-0001.html>


More information about the ghc-commits mailing list