[BUG]:network.open wrong error argument on callback in connect using bun
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 42/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- bun, javascript, node.js
- 領域
- networking
調査の方向性
まず Network.prototype.open を見つけ、Node.js と Bun におけるその callback の処理を、issue に含まれている再現例と比較します。両方の runtime で接続に失敗した際に callback が一貫したエラー値を受け取れば完了です。動作を確認するため、示されている例を再実行してください。
索引モデルが issue の本文から書いたものです。
説明
Description of the bug
Using bun, escpos-network behaves differently in the open method, specifically the error argument.
It is set to a Socket instance when using bun (1.1.45+196621f25), not using node (22.8.0)
I also opened a bug in bun.
Steps To Reproduce
I extracted the relevant code here and call both open (with a fix attempt) and open2 (current implementation in main). open2 fail with bun.
const net = require('net');
const EventEmitter = require('events');
const util = require('util');
function Network(address, port) {
EventEmitter.call(this);
this.address = address;
this.port = port || 9100;
this.device = new net.Socket();
return this;
}
util.inherits(Network, EventEmitter);
Network.prototype.open = function(callback) {
const self = this;
this.device.on('error', (err) => {
console.log('error', err);
callback && callback(err, self.device);
}).on('data', buf => {
// console.log('printer say:', buf);
}).connect(this.port, this.address, function(err) {
if (err && err instanceof Error) {
console.log('connect error', err);
callback && callback(err, self.device);
return;
}
self.emit('connect', self.device);
callback && callback(null, self.device);
});
return this;
};
Network.prototype.open2 = function(callback){
var self = this;
this.device.on("error", (err) => {
callback && callback(err, self.device);
}).on('data', buf => {
// console.log('printer say:', buf);
}).connect(this.port, this.address, function(err){
self.emit('connect', self.device);
callback && callback(err, self.device);
});
return this;
};
// Usage example
let device = new Network('192.168.1.100', 9100);
device.open(function(error, device) {
if (error) {
console.log('Connection error open');
return;
}
console.log('Connected to device open');
device.end();
});
device = new Network('192.168.1.100', 9100);
device.open2(function(error, device) {
if (error) {
console.log('Connection error open2:');
return;
}
console.log('Connected to device open2');
device.end();
});
Additional Information
No response
- 主要言語
- TypeScript
- スター
- 1.6k
- フォーク
- 443
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
lsongdev/node-escpos のほかの issue
-
[BUG]:オープンbug
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
lsongdev/node-escpos#447 ·
-
[BUG]: AJCBOSEオープンbug
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
lsongdev/node-escpos#446 ·
-
Capt Bilalオープン
難易度 5/5 1週間以上 初心者へのやさしさ 1/100
lsongdev/node-escpos#443 ·
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
lsongdev/node-escpos#442 · リアクション 2 件 ·
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
lsongdev/node-escpos#441 · コメント 5 件 · リアクション 1 件 ·
lsongdev/node-escpos の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
NousResearch/hermes-agent#136483 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
factory-active factory-automatic task-bug-reproduction-success task-identify-harness-labels-done task-identify-issue-type-done
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: Web chat input doesn't regain focus after a reply finishes対応中かも @GaijinSystems が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
zeroclaw-labs/zeroclaw#11658 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
babylonlabs-io/babylon-toolkit#2711 ·
メンテナーはふだん 1 日以内に返信