Skip to content

Commit

Permalink
Merge pull request #102 from Acconut/git-bin
Browse files Browse the repository at this point in the history
Quote git binary path
  • Loading branch information
svnlto committed Mar 2, 2014
2 parents 7c2ecb7 + 3019582 commit 2f7c6ed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/hoodie/new.js
@@ -1,5 +1,6 @@
var Command = require('./util/command');
var npmutils = require('./util/npm');
var gitUtils = require('./util/git');
var dirUtils = require('./util/dir');

var util = require('util');
Expand Down Expand Up @@ -125,7 +126,7 @@ CreateCommand.prototype.fetch = function (options, ctx, callback) {
options.gitArgs.push('-b', options.template.branch);
}

shell.exec(shell.which('git') + ' ' + options.gitArgs.join(' '), options.execArgs, function(err) {
shell.exec(gitUtils.bin() + ' ' + options.gitArgs.join(' '), options.execArgs, function(err) {

if (err) {
self.hoodie.emit('error', 'Could not fetch project from ' + options.template.uri);
Expand Down
13 changes: 13 additions & 0 deletions lib/hoodie/util/git.js
@@ -0,0 +1,13 @@
var shell = require('shelljs');

exports.bin = function () {

var path = shell.which('git');

// Add quotation in case the path contains a space
// This happens on windows (c:\program files\nodejs\...)
path = '"' + path + '"';

return path;

};

0 comments on commit 2f7c6ed

Please sign in to comment.