Closed jhohlfeld closed 4 months ago
Hey @mackermans could you take a look into this? It would be an easy fix and really could help me a lot using node-jq with bun.
May I offer to post a merge request?
Hi, happy to review a PR adding bun and ensure works in both runtimes
Description
I am using bun runtime and came across an issue that might be relevant for node-jq.
When running this example
bun raises a
TypeError: process.stdin.setEncoding is not a function.
.The error comes from this line: https://github.com/sanack/node-jq/blob/d339ef9c1713eddc78d5a68b0f5891ba040c3d62/src/exec.js#L35
Following the implementation, I found the spawning childProcess here: https://github.com/sanack/node-jq/blob/d339ef9c1713eddc78d5a68b0f5891ba040c3d62/src/exec.js#L13
Now my understanding is that process.stdin in a child process (subprocess.stdin) is a Writeable stream. However, according to nodejs' documentation, the Writable interface only has setDefaultEncoding, not
setEncoding
.Weirdly enough, the node runtime does define
setEncoding
on the Writable implementation in subprocess.stdin. From my perspective, the way bun is treating the implementation, it's more adhering to the documented behaviour.Maybe I am missing something and you may find it unrelated to node-jq. However, I still wanted to mention and would appreciate you feedback on it.
Repo for reproduction: https://github.com/jhohlfeld/nodejq-issue-681
Error Message & Stack Trace
Environment
Tell us which operating system you are using, as well as which versions of Node.js, npm/yarn, and node-jq.
Bun 1.1.5 Node 21.6.0 darwin 23.4.0 node-jq version: 4.3.1