Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setEncoding function missing #11011

Open
Almenon opened this issue May 11, 2024 · 0 comments
Open

setEncoding function missing #11011

Almenon opened this issue May 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Almenon
Copy link

Almenon commented May 11, 2024

What version of Bun is running?

Bun v1.1.8

What platform is your computer?

macOS arm64

What steps can reproduce the bug?

import { PythonShell } from 'python-shell';

PythonShell.runString('x=1+1;print(x)', null).then((messages) => {
  console.log('finished');
});

What is the expected behavior?

2 is shown.

What do you see instead?

$ bun example.js
128 | this.stderrParser = resolve('parse', options.stderrParser || 'text');
129 | this.terminated = false;
130 | this.childProcess = (0, child_process_1.spawn)(pythonPath, this.command, options);
131 | ['stdout', 'stdin', 'stderr'].forEach(function (name) {
132 | self[name] = self.childProcess[name];
133 | self.parser && self[name] && self[name].setEncoding(options.encoding || 'utf8');
^
TypeError: self[name].setEncoding is not a function. (In 'self[name].setEncoding(options.encoding || "utf8")', 'self[name].setEncoding' is undefined)
at /Users/exkazuu/ghq/github.com/WillBoosterLab/repair-ai/node_modules/python-shell/index.js:133:42
at forEach (:1:21)
at new PythonShell (/Users/exkazuu/ghq/github.com/WillBoosterLab/repair-ai/node_modules/python-shell/index.js:131:9)
at /Users/exkazuu/ghq/github.com/WillBoosterLab/repair-ai/node_modules/python-shell/index.js:252:27
at new Promise (:1:21)
at run (/Users/exkazuu/ghq/github.com/WillBoosterLab/repair-ai/node_modules/python-shell/index.js:251:16)
at /Users/exkazuu/ghq/github.com/WillBoosterLab/repair-ai/example.js:3:1

Additional information

This is a function supported by NodeJS (see https://nodejs.org/api/stream.html#readablesetencodingencoding), so I presume it should be supported by Bun as well.

@Almenon Almenon added the bug Something isn't working label May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant