From db463f9a8b51b76461b26e273665ddc939563bad Mon Sep 17 00:00:00 2001 From: dzdidi Date: Wed, 24 Jan 2024 11:00:11 +0000 Subject: [PATCH] tmp commit2 Signed-off-by: dzdidi --- src/rpc.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/rpc.js b/src/rpc.js index bf6de15..ac1a447 100644 --- a/src/rpc.js +++ b/src/rpc.js @@ -43,16 +43,20 @@ module.exports = class RPC { } pushHandler (req) { - console.error('pushHandler is to be implemented', req.toString()) const { url, repo, key, branch } = this.parsePushCommand(req) - console.error('url', url) - console.error('repo', repo) - console.error('key', key) - console.error('branch', branch) // TODO: check ACL // collect stdout to buffer and return it - // const process = spawn('git', ['fetch', url, `${branch}:${branch}`], { env: { GIT_DIR: getCodePath(name) } }) - console.error('pushHandler not implemented') + const process = spawn('git', ['fetch', url, `${branch}:${branch}`], { env: { GIT_DIR: getCodePath(name) } }) + const outBuffer = new Buffer() + const errBuffer = new Buffer() + process.stdout.on('data', data => { + outBuffer.push(data) + console.error('data', JSON.stringify(data.toString())) + }) + process.stderr.on('data', data => { + errBuffer.push(data) + console.error('error', JSON.stringify(data.toString())) + }) } forcePushHandler (req) {