Skip to content

Commit

Permalink
restore pythonbridge file (bugfix)
Browse files Browse the repository at this point in the history
  • Loading branch information
sylviiu committed Mar 4, 2024
1 parent 3538c37 commit 27fac71
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions util/pythonBridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ module.exports = {
}

module.exports.bridgeProc.stderr.on(`data`, d => parseLog(d, `ERR`));
module.exports.bridgeProc.stdout.on(`data`, d => parseLog(d, `OUT`));

let existingData = ``;

Expand All @@ -209,18 +208,15 @@ module.exports = {

if(!data.includes(`\n\r`)) {
existingData += data;
console.log(`existingData (appended): ${existingData.length}`)
return;
} else {
if(existingData) {
data = existingData + data;
console.log(`existingData (reset): ${data.length}`)
existingData = ``;
} else console.log(`existingData (nothing; no reset): ${data.length}`)
}

const parse = (msg) => {
const data = JSON.parse(msg.toString().trim());
console.log(`bridge data for id ${data.id} (exists: ${module.exports.idHooks.find(h => h.id == data.id) ? `yes` : `no`}): [${data.type}] ${data.content.length}`);
if(data.id) {
module.exports.idHooks.filter(h => h.id == data.id).forEach(h => h.func(data));
};
Expand Down

0 comments on commit 27fac71

Please sign in to comment.