@hunterzhu/pulse-adapters 0.1.8 → 0.1.10
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/dist/tools/shell.js +9 -1
- package/package.json +3 -3
package/dist/tools/shell.js
CHANGED
|
@@ -9,7 +9,7 @@ export function runShell(command, args = [], options = {}) {
|
|
|
9
9
|
if (options.timeoutMs !== undefined && (!Number.isFinite(options.timeoutMs) || options.timeoutMs < 0))
|
|
10
10
|
return Promise.reject(shellError('INVALID_SHELL_TIMEOUT'));
|
|
11
11
|
return new Promise((resolve, reject) => {
|
|
12
|
-
const child = spawn(command, args, { cwd: options.cwd, env: options.env, shell: false, detached: process.platform !== 'win32' });
|
|
12
|
+
const child = spawn(command, args, { cwd: options.cwd, env: options.env, shell: false, detached: process.platform !== 'win32', windowsHide: true });
|
|
13
13
|
let stdout = '';
|
|
14
14
|
let stderr = '';
|
|
15
15
|
let truncated = false;
|
|
@@ -34,6 +34,14 @@ export function runShell(command, args = [], options = {}) {
|
|
|
34
34
|
}
|
|
35
35
|
catch { /* process group may already be gone */ }
|
|
36
36
|
}
|
|
37
|
+
if (process.platform === 'win32' && child.pid) {
|
|
38
|
+
// child.kill() only terminates the direct process on Windows; kill the
|
|
39
|
+
// owned process tree so cancelled shell tools cannot leave descendants.
|
|
40
|
+
const tree = spawn('taskkill.exe', ['/PID', String(child.pid), '/T', '/F'], { stdio: 'ignore', windowsHide: true });
|
|
41
|
+
tree.once('error', () => child.kill(signal));
|
|
42
|
+
tree.unref();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
37
45
|
child.kill(signal);
|
|
38
46
|
};
|
|
39
47
|
let termination;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hunterzhu/pulse-adapters",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/zhuhengtan/Pulse"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"registry": "https://registry.npmjs.org"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@hunterzhu/pulse-runtime": "0.1.
|
|
20
|
-
"@hunterzhu/pulse-tool-sdk": "0.1.
|
|
19
|
+
"@hunterzhu/pulse-runtime": "0.1.10",
|
|
20
|
+
"@hunterzhu/pulse-tool-sdk": "0.1.10"
|
|
21
21
|
}
|
|
22
22
|
}
|