Skip to content
This repository was archived by the owner on Feb 8, 2019. It is now read-only.

Commit 28597aa

Browse files
committed
fix(): detection of packages listedIn give false positive when version was not set
1 parent 541cb32 commit 28597aa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plugins/system-checker/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ module.exports = {
2727
const match = buffer.toString().match(regexp);
2828
if (match && match.length > 1) {
2929
version = match[1].replace(os.EOL, '');
30+
} else {
31+
version = false;
3032
}
3133
}
3234
return version;
@@ -67,12 +69,12 @@ module.exports = {
6769
};
6870
const _check = (cmd, options, result) => new Promise((ok, ko) => {
6971
let out = {version: options.version};
72+
const actual = _getVersion(cmd, result, options);
7073
if (options.version) {
7174
if (result.status !== 0 && !options.listedIn) {
7275
out.error = `'${cmd}' is not found!!`;
7376
out.data = result.stderr.toString();
7477
} else {
75-
let actual = _getVersion(cmd, result, options);
7678
if (!semver.satisfies(actual, options.version)) {
7779
out.error = `not satisfied by: '${actual}'`;
7880
} else {
@@ -83,7 +85,7 @@ module.exports = {
8385
if (result.status === 127) {
8486
out.error = `'${cmd}' is not accesible!!`;
8587
out.data = result.stderr.toString();
86-
} else if (result.status === -100) {
88+
} else if (result.status === -100 || (options.listedIn && actual === false)) {
8789
out.version = out.version ? out.version : 'any';
8890
out.error = `'${options.key}' is not in list!!`;
8991
out.data = result.stderr.toString();

0 commit comments

Comments
 (0)