pubo-node 1.0.195 → 1.0.197
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/child-process/index.js +4 -3
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -3
- package/package.json +2 -2
|
@@ -110,6 +110,7 @@ function getProcessCommandByPid(pid) {
|
|
|
110
110
|
// 判断进程是否死亡
|
|
111
111
|
async function isProcessDied(pid) {
|
|
112
112
|
const used = await getProcessCpuUseByPid(pid);
|
|
113
|
+
// console.log(`pid: ${pid}, used: ${used}`);
|
|
113
114
|
return used < 0;
|
|
114
115
|
}
|
|
115
116
|
// 获取子进程
|
|
@@ -124,8 +125,8 @@ function getProcessByPpid(pid) {
|
|
|
124
125
|
resolve(stdout
|
|
125
126
|
.split('\n')
|
|
126
127
|
.filter((item) => !!item)
|
|
127
|
-
.map((item) =>
|
|
128
|
-
.filter((item) => item !== child.pid));
|
|
128
|
+
.map((item) => parseInt(item.trim()))
|
|
129
|
+
.filter((item) => item !== child.pid && !isNaN(item)));
|
|
129
130
|
child = null;
|
|
130
131
|
}
|
|
131
132
|
});
|
|
@@ -158,7 +159,7 @@ async function _SIGKILL(pid, signal = 2, times = 1) {
|
|
|
158
159
|
if (times > 5) {
|
|
159
160
|
throw new Error('SIGKILL 失败. times > 5');
|
|
160
161
|
}
|
|
161
|
-
(0, child_process_1.exec)(`kill -${signal} ${pid}
|
|
162
|
+
await new Promise((resolve) => (0, child_process_1.exec)(`kill -${signal} ${pid}`, resolve));
|
|
162
163
|
try {
|
|
163
164
|
await (0, pubo_utils_1.waitFor)(async () => isProcessDied(pid), {
|
|
164
165
|
checkTime: 100,
|
package/lib/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ export { JsonStorage } from './storage/json';
|
|
|
2
2
|
export { FtpClient, FtpClientPool } from './ftp-client';
|
|
3
3
|
export type { FtpConnectOptions, FtpFile } from './ftp-client';
|
|
4
4
|
export { createRpcClient, GrpcList } from './grpc';
|
|
5
|
-
export { SIGKILL, isProcessDied, getProcessName, getProcessTree, getProcessByPpid, getProcessCpuUseByPid, getProcessCommandByPid, getProcessList, getPidByPort, heartbeat, getDiskUsage, } from './child-process';
|
|
6
5
|
export { isPortAvailable } from './utils';
|
|
6
|
+
export { SIGKILL, isProcessDied, getProcessName, getProcessTree, getProcessByPpid, getProcessCpuUseByPid, getProcessCommandByPid, getProcessList, getPidByPort, heartbeat, getDiskUsage, } from './child-process';
|
|
7
7
|
export { getWifiName, getNetworks } from './utils/network';
|
|
8
8
|
export { RosTopicManager, RosTopic } from './ros/topic';
|
|
9
9
|
export { PuboFileSystem } from './file-system';
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PProcess = exports.PuboFileSystem = exports.RosTopic = exports.RosTopicManager = exports.getNetworks = exports.getWifiName = exports.
|
|
3
|
+
exports.PProcess = exports.PuboFileSystem = exports.RosTopic = exports.RosTopicManager = exports.getNetworks = exports.getWifiName = exports.getDiskUsage = exports.heartbeat = exports.getPidByPort = exports.getProcessList = exports.getProcessCommandByPid = exports.getProcessCpuUseByPid = exports.getProcessByPpid = exports.getProcessTree = exports.getProcessName = exports.isProcessDied = exports.SIGKILL = exports.isPortAvailable = exports.GrpcList = exports.createRpcClient = exports.FtpClientPool = exports.FtpClient = exports.JsonStorage = void 0;
|
|
4
4
|
var json_1 = require("./storage/json");
|
|
5
5
|
Object.defineProperty(exports, "JsonStorage", { enumerable: true, get: function () { return json_1.JsonStorage; } });
|
|
6
6
|
var ftp_client_1 = require("./ftp-client");
|
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "FtpClientPool", { enumerable: true, get: functio
|
|
|
9
9
|
var grpc_1 = require("./grpc");
|
|
10
10
|
Object.defineProperty(exports, "createRpcClient", { enumerable: true, get: function () { return grpc_1.createRpcClient; } });
|
|
11
11
|
Object.defineProperty(exports, "GrpcList", { enumerable: true, get: function () { return grpc_1.GrpcList; } });
|
|
12
|
+
var utils_1 = require("./utils");
|
|
13
|
+
Object.defineProperty(exports, "isPortAvailable", { enumerable: true, get: function () { return utils_1.isPortAvailable; } });
|
|
12
14
|
var child_process_1 = require("./child-process");
|
|
13
15
|
Object.defineProperty(exports, "SIGKILL", { enumerable: true, get: function () { return child_process_1.SIGKILL; } });
|
|
14
16
|
Object.defineProperty(exports, "isProcessDied", { enumerable: true, get: function () { return child_process_1.isProcessDied; } });
|
|
@@ -21,8 +23,6 @@ Object.defineProperty(exports, "getProcessList", { enumerable: true, get: functi
|
|
|
21
23
|
Object.defineProperty(exports, "getPidByPort", { enumerable: true, get: function () { return child_process_1.getPidByPort; } });
|
|
22
24
|
Object.defineProperty(exports, "heartbeat", { enumerable: true, get: function () { return child_process_1.heartbeat; } });
|
|
23
25
|
Object.defineProperty(exports, "getDiskUsage", { enumerable: true, get: function () { return child_process_1.getDiskUsage; } });
|
|
24
|
-
var utils_1 = require("./utils");
|
|
25
|
-
Object.defineProperty(exports, "isPortAvailable", { enumerable: true, get: function () { return utils_1.isPortAvailable; } });
|
|
26
26
|
var network_1 = require("./utils/network");
|
|
27
27
|
Object.defineProperty(exports, "getWifiName", { enumerable: true, get: function () { return network_1.getWifiName; } });
|
|
28
28
|
Object.defineProperty(exports, "getNetworks", { enumerable: true, get: function () { return network_1.getNetworks; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pubo-node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.197",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"pubo-utils": "^1.0.195",
|
|
22
22
|
"yaml": "^2.5.1"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "b3ec410db34a691f8f7bc82c908d0a58a00d02ce",
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"del": "^5.1.0",
|
|
27
27
|
"eslint": "^8.42.0",
|