From b7c9e4ea105d45e9984f597da7615eb8e477936d Mon Sep 17 00:00:00 2001 From: Joe Becher Date: Tue, 19 May 2020 09:48:08 -0400 Subject: [PATCH] Switch from execSync to execFileSync --- .idea/.gitignore | 7 +++++++ lib/codecov.js | 15 ++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..03edeb0b --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,7 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ + +.idea/ \ No newline at end of file diff --git a/lib/codecov.js b/lib/codecov.js index 2a8cc448..f314f247 100644 --- a/lib/codecov.js +++ b/lib/codecov.js @@ -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') @@ -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) { @@ -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.') } @@ -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() } @@ -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')