@abtnode/util 1.16.29-beta-2eaf40bc → 1.16.29-beta-cbfd116d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/run-script.js +17 -14
- package/package.json +6 -6
package/lib/run-script.js
CHANGED
|
@@ -83,7 +83,6 @@ const runScript = (script, label, options = {}) => {
|
|
|
83
83
|
const promise = new Promise((resolve, reject) => {
|
|
84
84
|
process.stdout.setMaxListeners(0);
|
|
85
85
|
process.stderr.setMaxListeners(0);
|
|
86
|
-
|
|
87
86
|
let [command, ...args] = script.split(' ');
|
|
88
87
|
if (fs.existsSync(command) === false) {
|
|
89
88
|
command = which.sync(command);
|
|
@@ -134,20 +133,8 @@ const runScript = (script, label, options = {}) => {
|
|
|
134
133
|
|
|
135
134
|
let hasUnhandledRejection = false;
|
|
136
135
|
const errorMessages = [];
|
|
137
|
-
child.stderr.on('data', (err) => {
|
|
138
|
-
errorMessages.push(err);
|
|
139
|
-
if (err.includes('UnhandledPromiseRejectionWarning')) {
|
|
140
|
-
hasUnhandledRejection = true;
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
136
|
|
|
144
|
-
|
|
145
|
-
console.error(err);
|
|
146
|
-
errorMessages.push(err.message);
|
|
147
|
-
return reject(new Error(errorMessages.join('\r\n')));
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
child.on('close', (code, signal) => {
|
|
137
|
+
const handleExit = (code, signal) => {
|
|
151
138
|
if (signal) {
|
|
152
139
|
if (Date.now() - now > timeout) {
|
|
153
140
|
return reject(new Error(`Process timeout after ${timeout / 1000} seconds`));
|
|
@@ -162,7 +149,23 @@ const runScript = (script, label, options = {}) => {
|
|
|
162
149
|
}
|
|
163
150
|
|
|
164
151
|
return resolve({ code, script });
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
child.stderr.on('data', (err) => {
|
|
155
|
+
errorMessages.push(err);
|
|
156
|
+
if (err.includes('UnhandledPromiseRejectionWarning')) {
|
|
157
|
+
hasUnhandledRejection = true;
|
|
158
|
+
}
|
|
165
159
|
});
|
|
160
|
+
|
|
161
|
+
child.on('error', (err) => {
|
|
162
|
+
console.error(err);
|
|
163
|
+
errorMessages.push(err.message);
|
|
164
|
+
return reject(new Error(errorMessages.join('\r\n')));
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
child.on('close', handleExit);
|
|
168
|
+
child.on('exit', handleExit);
|
|
166
169
|
});
|
|
167
170
|
|
|
168
171
|
promise.abort = cleanup;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.29-beta-
|
|
6
|
+
"version": "1.16.29-beta-cbfd116d",
|
|
7
7
|
"description": "ArcBlock's JavaScript utility",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"author": "polunzh <polunzh@gmail.com> (http://github.com/polunzh)",
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@abtnode/constant": "1.16.29-beta-
|
|
22
|
-
"@abtnode/logger": "1.16.29-beta-
|
|
21
|
+
"@abtnode/constant": "1.16.29-beta-cbfd116d",
|
|
22
|
+
"@abtnode/logger": "1.16.29-beta-cbfd116d",
|
|
23
23
|
"@arcblock/pm2": "^5.4.0",
|
|
24
|
-
"@blocklet/constant": "1.16.29-beta-
|
|
25
|
-
"@blocklet/meta": "1.16.29-beta-
|
|
24
|
+
"@blocklet/constant": "1.16.29-beta-cbfd116d",
|
|
25
|
+
"@blocklet/meta": "1.16.29-beta-cbfd116d",
|
|
26
26
|
"@ocap/client": "1.18.126",
|
|
27
27
|
"@ocap/mcrypto": "1.18.126",
|
|
28
28
|
"@ocap/util": "1.18.126",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"fs-extra": "^11.2.0",
|
|
80
80
|
"jest": "^29.7.0"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "e9bdb7af77f2d126e40195c67972b07fe683adf9"
|
|
83
83
|
}
|