From 4af22cfbc0e182bc5ac036aa2aedf510ea4bb705 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 31 Mar 2015 23:39:13 -0700 Subject: [PATCH] [test] Replace sync-exec with spawn-sync sync-exec has performance issue on Windows --- package.json | 2 +- test/helpers.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 4f2d2dee..7d40aaa5 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/test/helpers.js b/test/helpers.js index 166b63c5..ae129313 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -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) {