From f19a1c16dfc1f11f6ca6fca36da923c59dbf3b99 Mon Sep 17 00:00:00 2001 From: Dimitri Date: Tue, 27 Nov 2018 01:50:16 +0100 Subject: [PATCH] Change to support node-git-server on windows as per (#41) https://github.com/substack/pushover/issues/34 --- lib/service.js | 8 +++++++- lib/util.js | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/service.js b/lib/service.js index 4af2f20..2f1cfdd 100644 --- a/lib/service.js +++ b/lib/service.js @@ -96,7 +96,13 @@ class Service extends HttpDuplex { self.once('accept', function onAccept() { process.nextTick(function() { - var cmd = ['git-' + opts.service, '--stateless-rpc', opts.cwd]; + var cmd = null; + var isWin = /^win/.test(process.platform); + if (isWin) { + cmd = ['git', opts.service, '--stateless-rpc', opts.cwd]; + } else { + cmd = ['git-' + opts.service, '--stateless-rpc', opts.cwd]; + } var ps = spawn(cmd[0], cmd.slice(1)); ps.on('error', function(err) { self.emit('error', new Error(`${err.message} running command ${cmd.join(' ')}`)); diff --git a/lib/util.js b/lib/util.js index 5720a3f..04635a4 100644 --- a/lib/util.js +++ b/lib/util.js @@ -84,7 +84,14 @@ const Util = { res.write(pack('# service=git-' + service + '\n')); res.write('0000'); - const cmd = ['git-' + service, '--stateless-rpc', '--advertise-refs', repoLocation]; + var cmd = null; + var isWin = /^win/.test(process.platform); + if (isWin) { + cmd = ['git', service, '--stateless-rpc', '--advertise-refs', repoLocation]; + } else { + cmd = ['git-' + service, '--stateless-rpc', '--advertise-refs', repoLocation]; + } + const ps = spawn(cmd[0], cmd.slice(1)); ps.on('error', (err) => { dup.emit('error', new Error(`${err.message} running command ${cmd.join(' ')}`));