This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
Switch from execSync to execFileSync #180
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b7c9e4e
Switch from execSync to execFileSync
drazisil 00f0a96
Call existsSync instead of executing `if`
drazisil 43904fc
Trigger a build
drazisil a4cc565
I think this fixes linux and macos...
drazisil 2956ed4
Only add more_patterns of it has a value. Correct windows.
drazisil 27792cc
Remove default value to more_patterns, change windows to winPatterns
drazisil 46aed7b
Try a colon.
drazisil de77ff3
Let's try not using MinGw...
drazisil 7148c18
What are the chances that Windows has a find?
drazisil e9bd861
Put it back
drazisil caca56c
Reverting Windows side so this can me merged in time if needed.
drazisil 40caa82
Reverting Windows side so this can me merged in time if needed.
drazisil aa09765
Update lib/codecov.js
drazisil 1dd9c25
Update lib/codecov.js
drazisil 9f0c2c9
Set initial values
drazisil File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,21 +4,23 @@ 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') | ||
|
||
var version = 'v' + require('../package.json').version | ||
|
||
var patterns, | ||
more_patterns = '' | ||
var patterns = '' | ||
var more_patterns = '' | ||
var winPatterns = '' | ||
|
||
var isWindows = | ||
process.platform.match(/win32/) || process.platform.match(/win64/) | ||
|
||
if (!isWindows) { | ||
patterns = | ||
"-type f \\( -name '*coverage.*' " + | ||
patterns = ( | ||
"-type f -name '*coverage.*' " + | ||
"-or -name 'nosetests.xml' " + | ||
"-or -name 'jacoco*.xml' " + | ||
"-or -name 'clover.xml' " + | ||
|
@@ -29,7 +31,7 @@ if (!isWindows) { | |
"-or -name '*.lcov' " + | ||
"-or -name 'gcov.info' " + | ||
"-or -name '*.gcov' " + | ||
"-or -name '*.lst' \\) " + | ||
"-or -name '*.lst' " + | ||
"-not -name '*.sh' " + | ||
"-not -name '*.data' " + | ||
"-not -name '*.py' " + | ||
|
@@ -76,9 +78,10 @@ if (!isWindows) { | |
"-not -path '*/$bower_components/*' " + | ||
"-not -path '*/node_modules/*' " + | ||
"-not -path '*/conftest_*.c.gcov'" | ||
).split(' ') | ||
} else { | ||
patterns = | ||
'/a-d /b /s *coverage.* ' + | ||
winPatterns = ( | ||
'/a:-d /b /s *coverage.* ' + | ||
'/s nosetests.xml ' + | ||
'/s jacoco*.xml ' + | ||
'/s clover.xml ' + | ||
|
@@ -136,6 +139,7 @@ if (!isWindows) { | |
'| findstr /i /v \\\\$bower_components\\ ' + | ||
'| findstr /i /v \\node_modules\\ ' + | ||
'| findstr /i /v \\conftest_.*\\.c\\.gcov ' | ||
).split(' ') | ||
} | ||
|
||
var sendToCodecovV2 = function( | ||
|
@@ -355,7 +359,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) { | ||
|
@@ -414,7 +418,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.') | ||
} | ||
|
@@ -431,19 +435,23 @@ var upload = function(args, on_success, on_failure) { | |
.toString() | ||
.trim() | ||
} else { | ||
bowerrc = execSync('if exist .bowerrc type .bowerrc', { cwd: root }) | ||
.toString() | ||
.trim() | ||
bowerrc = fs.existsSync('.bowerrc') | ||
} | ||
if (bowerrc) { | ||
bowerrc = JSON.parse(bowerrc).directory | ||
if (bowerrc) { | ||
if (!isWindows) { | ||
more_patterns = | ||
" -not -path '*/" + bowerrc.toString().replace(/\/$/, '') + "/*'" | ||
more_patterns = ( | ||
" -not -path '*/" + | ||
bowerrc.toString().replace(/\/$/, '') + | ||
"/*'" | ||
).split(' ') | ||
} else { | ||
more_patterns = | ||
'| findstr /i /v \\' + bowerrc.toString().replace(/\/$/, '') + '\\' | ||
more_patterns = ( | ||
'| findstr /i /v \\' + | ||
bowerrc.toString().replace(/\/$/, '') + | ||
'\\' | ||
).split(' ') | ||
} | ||
} | ||
} | ||
|
@@ -474,15 +482,26 @@ var upload = function(args, on_success, on_failure) { | |
} else if ((args.options.disable || '').split(',').indexOf('search') === -1) { | ||
console.log('==> Scanning for reports') | ||
var _files | ||
var _findArgs | ||
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 | ||
_findArgs = [root].concat(patterns) | ||
if (more_patterns) { | ||
_findArgs.concat(more_patterns) | ||
} | ||
_files = execFileSync('find', _findArgs) | ||
.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) | ||
_findArgs = [root].concat(winPatterns) | ||
if (more_patterns) { | ||
_findArgs.concat(more_patterns) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here with |
||
} | ||
_files = execSync('dir ' + winPatterns.join(' ') + more_patterns) | ||
Comment on lines
+500
to
+504
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like nothing is happening with |
||
.toString() | ||
.trim() | ||
.split('\r\n') | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
concat
doesn't mutate, it returns a new instance. So in this case you'd need to do_findArgs = _findArgs.concat(more_patterns)