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

Commit

Permalink
Switch from execSync to execFileSync
Browse files Browse the repository at this point in the history
  • Loading branch information
drazisil committed May 19, 2020
1 parent bb79335 commit b7c9e4e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions lib/codecov.js
Expand Up @@ -4,6 +4,7 @@ var request = require('teeny-request').teenyRequest
var urlgrey = require('urlgrey')
var jsYaml = require('js-yaml')
var walk = require('ignore-walk')
var execFileSync = require('child_process').execFileSync
var execSync = require('child_process').execSync

var detectProvider = require('./detect')
Expand Down Expand Up @@ -355,7 +356,7 @@ var upload = function(args, on_success, on_failure) {
console.log('==> Building file structure')
try {
upload +=
execSync('git ls-files || hg locate', { cwd: root })
execFileSync('git', ['ls-files', '||', 'hg', 'locate'], { cwd: root })
.toString()
.trim() + '\n<<<<<< network\n'
} catch (err) {
Expand Down Expand Up @@ -414,7 +415,7 @@ var upload = function(args, on_success, on_failure) {
}
debug.push(gcov)
console.log(' $ ' + gcov)
execSync(gcov)
execFileSync(gcov)
} catch (e) {
console.log(' Failed to run gcov command.')
}
Expand All @@ -431,7 +432,9 @@ var upload = function(args, on_success, on_failure) {
.toString()
.trim()
} else {
bowerrc = execSync('if exist .bowerrc type .bowerrc', { cwd: root })
bowerrc = execFileSync('if', ['exist', '.bowerrc', 'type', '.bowerrc'], {
cwd: root,
})
.toString()
.trim()
}
Expand Down Expand Up @@ -475,14 +478,16 @@ var upload = function(args, on_success, on_failure) {
console.log('==> Scanning for reports')
var _files
if (!isWindows) {
_files = execSync('find ' + root + ' ' + patterns + more_patterns)
// @TODO support for a root directory
// It's not straightforward due to the nature of the find command
_files = execFileSync('find', [root, patterns, more_patterns])
.toString()
.trim()
.split('\n')
} else {
// @TODO support for a root directory
// It's not straightforward due to the nature of the dir command
_files = execSync('dir ' + patterns + more_patterns)
_files = execFileSync('dir', [patterns, more_patterns])
.toString()
.trim()
.split('\r\n')
Expand Down

0 comments on commit b7c9e4e

Please sign in to comment.