emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ob-js uses deprecated Node APIs
@ 2020-03-10 23:47 Ivan Sokolov
  2020-05-20 20:05 ` Matthew Lundin
  2020-05-22 14:09 ` Bastien
  0 siblings, 2 replies; 3+ messages in thread
From: Ivan Sokolov @ 2020-03-10 23:47 UTC (permalink / raw)
  To: emacs-orgmode

I ran into problems with ob-js. When resolving them, I found that require ('sys') is deprecated, there is a patch.

diff --git a/lisp/ob-js.el b/lisp/ob-js.el
index 7592040ab..d459e8069 100644
--- a/lisp/ob-js.el
+++ b/lisp/ob-js.el
@@ -65,7 +65,7 @@
   :safe #'stringp)
 
 (defvar org-babel-js-function-wrapper
-  "require('sys').print(require('sys').inspect(function(){\n%s\n}()));"
+  "require('process').stdout.write(require('util').inspect(function(){%s}()));"
   "Javascript code to print value of body.")
 
 (defun org-babel-execute:js (body params)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: ob-js uses deprecated Node APIs
  2020-03-10 23:47 ob-js uses deprecated Node APIs Ivan Sokolov
@ 2020-05-20 20:05 ` Matthew Lundin
  2020-05-22 14:09 ` Bastien
  1 sibling, 0 replies; 3+ messages in thread
From: Matthew Lundin @ 2020-05-20 20:05 UTC (permalink / raw)
  To: Ivan Sokolov, emacs-orgmode

Ivan Sokolov <ivan-p-sokolov@ya.ru> writes:

> I ran into problems with ob-js. When resolving them, I found that require ('sys') is deprecated, there is a patch.
>
> diff --git a/lisp/ob-js.el b/lisp/ob-js.el
> index 7592040ab..d459e8069 100644
> --- a/lisp/ob-js.el
> +++ b/lisp/ob-js.el
> @@ -65,7 +65,7 @@
>    :safe #'stringp)
>  
>  (defvar org-babel-js-function-wrapper
> -  "require('sys').print(require('sys').inspect(function(){\n%s\n}()));"
> +  "require('process').stdout.write(require('util').inspect(function(){%s}()));"
>    "Javascript code to print value of body.")
>  
>  (defun org-babel-execute:js (body params)

I can confirm that I just encountered this bug today and that Ivan's
patch resolves the issue.

See here for more information:

https://nodejs.org/api/deprecations.html#deprecations_dep0025_require_sys

Best,
Matt



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ob-js uses deprecated Node APIs
  2020-03-10 23:47 ob-js uses deprecated Node APIs Ivan Sokolov
  2020-05-20 20:05 ` Matthew Lundin
@ 2020-05-22 14:09 ` Bastien
  1 sibling, 0 replies; 3+ messages in thread
From: Bastien @ 2020-05-22 14:09 UTC (permalink / raw)
  To: Ivan Sokolov; +Cc: emacs-orgmode

Hi Ivan,

Ivan Sokolov <ivan-p-sokolov@ya.ru> writes:

> I ran into problems with ob-js. When resolving them, I found that
> require ('sys') is deprecated, there is a patch.

applied against the maint branch, thanks a lot, and thanks Matt for
confirming the issue.

-- 
 Bastien


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-22 14:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-10 23:47 ob-js uses deprecated Node APIs Ivan Sokolov
2020-05-20 20:05 ` Matthew Lundin
2020-05-22 14:09 ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).