|
8 | 8 | * VERSION BUMP.) |
9 | 9 | */ |
10 | 10 |
|
11 | | -var crossSpawnAsync = require('cross-spawn-async') |
| 11 | +var crossSpawn = require('cross-spawn') |
12 | 12 | var fs = require('fs') |
13 | 13 | var minimist = require('minimist') |
14 | 14 | var mkdirp = require('mkdirp') |
@@ -68,7 +68,7 @@ test('test github repos that use `standard`', function (t) { |
68 | 68 | var url = pkg.repo + '.git' |
69 | 69 | var folder = path.join(TMP, name) |
70 | 70 | return function (cb) { |
71 | | - fs.access(path.join(TMP, name), fs.R_OK | fs.W_OK, function (err) { |
| 71 | + access(path.join(TMP, name), fs.R_OK | fs.W_OK, function (err) { |
72 | 72 | if (argv.offline) { |
73 | 73 | if (err) { |
74 | 74 | t.pass('SKIPPING (offline): ' + name + ' (' + pkg.repo + ')') |
@@ -122,11 +122,24 @@ test('test github repos that use `standard`', function (t) { |
122 | 122 | function spawn (command, args, opts, cb) { |
123 | 123 | if (!opts.stdio) opts.stdio = argv.quiet ? 'ignore' : 'inherit' |
124 | 124 |
|
125 | | - var child = crossSpawnAsync(command, args, opts) |
| 125 | + var child = crossSpawn(command, args, opts) |
126 | 126 | child.on('error', cb) |
127 | 127 | child.on('close', function (code) { |
128 | 128 | if (code !== 0) return cb(new Error('non-zero exit code: ' + code)) |
129 | 129 | cb(null) |
130 | 130 | }) |
131 | 131 | return child |
132 | 132 | } |
| 133 | + |
| 134 | +function access (path, mode, callback) { |
| 135 | + if (typeof mode === 'function') { |
| 136 | + return access(path, null, callback) |
| 137 | + } |
| 138 | + |
| 139 | + // Node v0.10 lacks `fs.access`, which is faster, so fallback to `fs.stat` |
| 140 | + if (typeof fs.access === 'function') { |
| 141 | + fs.access(path, mode, callback) |
| 142 | + } else { |
| 143 | + fs.stat(path, callback) |
| 144 | + } |
| 145 | +} |
0 commit comments