push working

Signed-off-by: dzdidi <deniszalessky@gmail.com>
This commit is contained in:
dzdidi
2024-01-24 12:06:24 +00:00
parent 584fe02d4e
commit 31b6952a06
2 changed files with 1 additions and 10 deletions

View File

@@ -122,7 +122,6 @@ async function talkToGit (refs, drive, repoName, rpc) {
// process.kill(daemonPid || home.getDaemonPid()) // process.kill(daemonPid || home.getDaemonPid())
// home.removeDaemonPid() // home.removeDaemonPid()
console.error('response', res.toString())
// process.stdout.write(res.toString()) // process.stdout.write(res.toString())
process.stdout.write('\n\n') process.stdout.write('\n\n')
process.exit(0) process.exit(0)

View File

@@ -50,21 +50,13 @@ module.exports = class RPC {
// collect stdout to buffer and return it // collect stdout to buffer and return it
return await new Promise((resolve, reject) => { return await new Promise((resolve, reject) => {
const process = spawn('git', ['fetch', url, `${branch}:${branch}`], { env: { GIT_DIR: home.getCodePath(repo) } }) const process = spawn('git', ['fetch', url, `${branch}:${branch}`], { env: { GIT_DIR: home.getCodePath(repo) } })
//let outBuffer = Buffer.from('')
// process.stdout.on('data', data => {
// console.error('data:', JSON.stringify(data.toString()))
// outBuffer = Buffer.concat([outBuffer, data])
// })
console.error('ARGS:', 'git', ['fetch', url, `${branch}:${branch}`], { env: { GIT_DIR: home.getCodePath(repo) } })
let errBuffer = Buffer.from('') let errBuffer = Buffer.from('')
process.stderr.on('data', data => { process.stderr.on('data', data => {
errBuffer = Buffer.concat([errBuffer, data]) errBuffer = Buffer.concat([errBuffer, data])
console.error('out in str:', errBuffer.toString())
}) })
// TODO: write buffer to standard output with ACL
process.on('close', code => { process.on('close', code => {
console.error('out on close:', errBuffer.toString())
console.error(`child process exited with code ${code}`)
return code === 0 ? resolve(errBuffer) : reject(errBuffer) return code === 0 ? resolve(errBuffer) : reject(errBuffer)
}) })
}) })