clean-scripts
Advanced tools
Comparing version 1.9.0-alpha.2 to 1.9.0-alpha.3
@@ -10,3 +10,2 @@ "use strict"; | ||
const packageJson = tslib_1.__importStar(require("../package.json")); | ||
const psTree = require('ps-tree'); | ||
const defaultConfigName = 'clean-scripts.config.js'; | ||
@@ -49,4 +48,22 @@ function showToolVersion() { | ||
subProcess.kill('SIGINT'); | ||
psTree(subProcess.pid, (_err, children) => { | ||
childProcess.spawn('kill', ['-9'].concat(children.map((p) => p.PID))); | ||
if (process.platform === 'win32') { | ||
childProcess.exec(`taskkill -F -T -PID ${subProcess.pid}`); | ||
} | ||
} | ||
if (process.platform === 'darwin' || process.platform === 'linux') { | ||
childProcess.exec('ps -l', (error, stdout) => { | ||
if (error) { | ||
console.log(error); | ||
} | ||
else { | ||
const ps = stdout.split('\n') | ||
.map(s => s.split(' ').filter(s => s)) | ||
.filter((s, i) => i > 0 && s.length >= 2) | ||
.map(s => ({ pid: +s[1], ppid: +s[2] })); | ||
const result = []; | ||
collectPids(process.pid, ps, result); | ||
for (const pid of result) { | ||
childProcess.exec(`kill -9 ${pid}`); | ||
} | ||
} | ||
}); | ||
@@ -69,1 +86,8 @@ } | ||
}); | ||
function collectPids(pid, ps, result) { | ||
const children = ps.filter(p => p.ppid === pid); | ||
for (const child of children) { | ||
result.push(child.pid); | ||
collectPids(child.pid, ps, result); | ||
} | ||
} |
{ | ||
"name": "clean-scripts", | ||
"version": "1.9.0-alpha.2", | ||
"version": "1.9.0-alpha.3", | ||
"description": "A CLI tool to make scripts in package.json clean.", | ||
@@ -46,3 +46,2 @@ "main": "dist/core.js", | ||
"pretty-ms": "3.1.0", | ||
"ps-tree": "1.1.0", | ||
"tslib": "1.9.1" | ||
@@ -49,0 +48,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17591
3
317
- Removedps-tree@1.1.0
- Removedduplexer@0.1.2(transitive)
- Removedevent-stream@3.3.5(transitive)
- Removedfrom@0.1.7(transitive)
- Removedmap-stream@0.0.7(transitive)
- Removedpause-stream@0.0.11(transitive)
- Removedps-tree@1.1.0(transitive)
- Removedsplit@1.0.1(transitive)
- Removedstream-combiner@0.2.2(transitive)
- Removedthrough@2.3.8(transitive)