[test] Replace sync-exec with spawn-sync

sync-exec has performance issue on Windows
This commit is contained in:
Adam Stankiewicz
2015-03-31 23:39:13 -07:00
parent ab4f8a0e39
commit 4af22cfbc0
2 changed files with 8 additions and 3 deletions

View File

@@ -77,7 +77,7 @@
"nock": "^0.56.0",
"node-uuid": "^1.4.2",
"proxyquire": "^1.3.0",
"sync-exec": "^0.5.0"
"spawn-sync": "^1.0.5"
},
"scripts": {
"test": "grunt test"

View File

@@ -12,7 +12,7 @@ var os = require('os');
var which = require('which');
var path = require('path');
var proxyquire = require('proxyquire').noCallThru().noPreserveCache();
var exec = require('sync-exec');
var spawnSync = require('spawn-sync');
var config = require('../lib/config');
// For better promise errors
@@ -145,8 +145,13 @@ exports.TempDir = (function() {
TempDir.prototype.git = function () {
var args = Array.prototype.slice.call(arguments);
var result = spawnSync('git', args, { cwd: this.path });
return exec('cd ' + this.path + ' && git ' + args.join(' ')).stdout;
if (result.status !== 0) {
throw new Error(result.stderr);
} else {
return result.stdout.toString();
}
};
TempDir.prototype.exists = function (name) {