Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit b7c9e4e

Browse files
committed
Switch from execSync to execFileSync
1 parent bb79335 commit b7c9e4e

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

.idea/.gitignore

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codecov.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var request = require('teeny-request').teenyRequest
44
var urlgrey = require('urlgrey')
55
var jsYaml = require('js-yaml')
66
var walk = require('ignore-walk')
7+
var execFileSync = require('child_process').execFileSync
78
var execSync = require('child_process').execSync
89

910
var detectProvider = require('./detect')
@@ -355,7 +356,7 @@ var upload = function(args, on_success, on_failure) {
355356
console.log('==> Building file structure')
356357
try {
357358
upload +=
358-
execSync('git ls-files || hg locate', { cwd: root })
359+
execFileSync('git', ['ls-files', '||', 'hg', 'locate'], { cwd: root })
359360
.toString()
360361
.trim() + '\n<<<<<< network\n'
361362
} catch (err) {
@@ -414,7 +415,7 @@ var upload = function(args, on_success, on_failure) {
414415
}
415416
debug.push(gcov)
416417
console.log(' $ ' + gcov)
417-
execSync(gcov)
418+
execFileSync(gcov)
418419
} catch (e) {
419420
console.log(' Failed to run gcov command.')
420421
}
@@ -431,7 +432,9 @@ var upload = function(args, on_success, on_failure) {
431432
.toString()
432433
.trim()
433434
} else {
434-
bowerrc = execSync('if exist .bowerrc type .bowerrc', { cwd: root })
435+
bowerrc = execFileSync('if', ['exist', '.bowerrc', 'type', '.bowerrc'], {
436+
cwd: root,
437+
})
435438
.toString()
436439
.trim()
437440
}
@@ -475,14 +478,16 @@ var upload = function(args, on_success, on_failure) {
475478
console.log('==> Scanning for reports')
476479
var _files
477480
if (!isWindows) {
478-
_files = execSync('find ' + root + ' ' + patterns + more_patterns)
481+
// @TODO support for a root directory
482+
// It's not straightforward due to the nature of the find command
483+
_files = execFileSync('find', [root, patterns, more_patterns])
479484
.toString()
480485
.trim()
481486
.split('\n')
482487
} else {
483488
// @TODO support for a root directory
484489
// It's not straightforward due to the nature of the dir command
485-
_files = execSync('dir ' + patterns + more_patterns)
490+
_files = execFileSync('dir', [patterns, more_patterns])
486491
.toString()
487492
.trim()
488493
.split('\r\n')

0 commit comments

Comments
 (0)