Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quote git binary path #102

Merged
merged 1 commit into from Mar 2, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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;

};