Comparing version 1.0.0 to 1.1.0
"use strict"; | ||
const childProcess = require("child_process"); | ||
function closeArgsToError (code, signal) { | ||
if (code !== 0) { | ||
if (code) { | ||
const err = new Error(`Exited with status ${code}`); | ||
@@ -42,8 +42,6 @@ err.exitStatus = code; | ||
if (error) { | ||
error.stderr = concatBuffer(stderr); | ||
error.stdout = stdout; | ||
error.stderr = concatBuffer(stderr); | ||
callback(error); | ||
} else { | ||
callback(null, stdout); | ||
} | ||
callback(error || null, stdout); | ||
}); | ||
@@ -67,6 +65,4 @@ } | ||
error.stdout = stdout; | ||
callback(error); | ||
} else { | ||
callback(null, stdout); | ||
} | ||
callback(error || null, stdout); | ||
} | ||
@@ -86,3 +82,3 @@ | ||
spawn("reg.exe", args, (error, stdout) => { | ||
if (!error && /^\s*\S+\s+REG(?:_[A-Z]+)+\s+(.*)$/im.test(stdout)) { | ||
if (stdout && /^\s*\S+\s+REG(?:_[A-Z]+)+\s+(.*)$/im.test(stdout)) { | ||
callback(null, RegExp.$1); | ||
@@ -89,0 +85,0 @@ } else { |
{ | ||
"name": "in-gfw", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Identify current location is located in mainland China.", | ||
@@ -29,3 +29,3 @@ "main": "lib/index.js", | ||
"pretest": "eslint *.js lib test", | ||
"test": "node . && nyc mocha" | ||
"test": "node . && nyc mocha --no-timeouts" | ||
}, | ||
@@ -60,12 +60,12 @@ "repository": { | ||
"ci-info": "^1.1.3", | ||
"codecov": "^3.0.0", | ||
"codecov": "^3.0.1", | ||
"eslint": "^4.19.1", | ||
"eslint-config-standard": "^11.0.0", | ||
"eslint-plugin-import": "^2.10.0", | ||
"eslint-plugin-import": "^2.11.0", | ||
"eslint-plugin-node": "^6.0.1", | ||
"eslint-plugin-promise": "^3.7.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"mocha": "^5.0.5", | ||
"eslint-plugin-standard": "^3.1.0", | ||
"mocha": "^5.1.1", | ||
"mock-fs": "^4.4.2", | ||
"nyc": "^11.6.0", | ||
"nyc": "^11.7.1", | ||
"proxyquire": "^2.0.1", | ||
@@ -72,0 +72,0 @@ "util-promisify": "^2.1.0" |
12439
344