mirror of
https://github.com/aljazceru/gitpear.git
synced 2025-12-17 14:14:22 +01:00
tmp: assume daemon is always running
Signed-off-by: dzdidi <deniszalessky@gmail.com>
This commit is contained in:
@@ -28,21 +28,21 @@ const repoName = matches[2]
|
||||
const store = new Corestore(RAM)
|
||||
const swarm = new Hyperswarm({ keypair: home.getKeyPair() })
|
||||
|
||||
let daemonPid
|
||||
if (!home.isDaemonRunning()) {
|
||||
const opts = {
|
||||
detached: true,
|
||||
stdio: [ 'ignore', home.getOutStream(), home.getErrStream() ]
|
||||
}
|
||||
const daemon = spawn('git-peard', opts)
|
||||
daemonPid = daemon.pid
|
||||
home.storeDaemonPid(daemonPid)
|
||||
// TODO: remove in case of error or exit but allow unref
|
||||
// daemon.on('error', home.removeDaemonPid)
|
||||
// daemon.on('exit', home.removeDaemonPid)
|
||||
console.error('started daemon', daemonPid)
|
||||
daemon.unref()
|
||||
}
|
||||
// let daemonPid
|
||||
// if (!home.isDaemonRunning()) {
|
||||
// const opts = {
|
||||
// detached: true,
|
||||
// stdio: [ 'ignore', home.getOutStream(), home.getErrStream() ]
|
||||
// }
|
||||
// const daemon = spawn('git-peard', opts)
|
||||
// daemonPid = daemon.pid
|
||||
// home.storeDaemonPid(daemonPid)
|
||||
// // TODO: remove in case of error or exit but allow unref
|
||||
// // daemon.on('error', home.removeDaemonPid)
|
||||
// // daemon.on('exit', home.removeDaemonPid)
|
||||
// console.error('started daemon', daemonPid)
|
||||
// daemon.unref()
|
||||
// }
|
||||
|
||||
swarm.join(crypto.discoveryKey(Buffer.from(targetKey, 'hex')), { server: false })
|
||||
|
||||
@@ -121,8 +121,8 @@ async function talkToGit (refs, drive, repoName, rpc) {
|
||||
const publicKey = home.readPk()
|
||||
const res = await rpc.request(command, Buffer.from(`${publicKey}/${repoName}:${dst}`))
|
||||
|
||||
process.kill(daemonPid || home.getDaemonPid())
|
||||
home.removeDaemonPid()
|
||||
// process.kill(daemonPid || home.getDaemonPid())
|
||||
// home.removeDaemonPid()
|
||||
|
||||
process.stdout.write(res.toString())
|
||||
process.stdout.write('\n\n')
|
||||
|
||||
Reference in New Issue
Block a user