From a867a3d6853de7317425192b841d37ad3514e4b5 Mon Sep 17 00:00:00 2001 From: dzdidi Date: Wed, 24 Jan 2024 11:22:31 +0000 Subject: [PATCH] fix buffer Signed-off-by: dzdidi --- src/rpc.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rpc.js b/src/rpc.js index aec6b7a..e9ae78d 100755 --- a/src/rpc.js +++ b/src/rpc.js @@ -49,15 +49,15 @@ module.exports = class RPC { // TODO: check ACL // collect stdout to buffer and return it const process = spawn('git', ['fetch', url, `${branch}:${branch}`], { env: { GIT_DIR: home.getCodePath(repo) } }) - const outBuffer = new Buffer() - const errBuffer = new Buffer() + const outBuffer = Buffer.from('') + const errBuffer = Buffer.from('') process.stdout.on('data', data => { - outBuffer.push(data) console.error('data:', JSON.stringify(data.toString())) + outBuffer.push(data) }) process.stderr.on('data', data => { - errBuffer.push(data) console.error('error:', JSON.stringify(data.toString())) + errBuffer.push(data) }) process.on('close', code => {